Skip to content

setEuiDevProviderWarning to accept an optional callback function #7807

@tsullivan

Description

@tsullivan

Is your feature request related to a problem? Please describe.

There's in-progress work to warn Kibana developers in a "soft" way when they have a React rendering tree that is missing EuiProvider: elastic/kibana#184608

My goal for the error behavior is to display a warning toast, and invoke a warning in the console. EUI offers a method called setEuiDevProviderWarning, and it can do the console warning, but it would need some enhancement in order to show the toast. (Of course, this behavior would be limited to dev mode.)

Describe the solution you'd like
A clear and concise description of what you want to happen.

I propose that setEuiDevProviderWarning accept an optional callback function. That would allow users of the method to add custom behavior, such as showing a warning toast.

Describe alternatives you've considered

  • Simply rely on console.warn, this is not noticeable enough.
  • Have EUI throw an error when EuiProvider context is missing. This is too disruptive.

Desired timeline
No rush

Additional context
I would like to deliver the PR to add this enhancement to EUI.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions