New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Start using useKibana context in data shim #46478
Start using useKibana context in data shim #46478
Conversation
Pass deps in using Context provider
Use notification.toasts in SearchBar Use context provider in top nav.
…plugin/stateful-search-bar
💔 Build Failed |
💚 Build Succeeded |
Pinging @elastic/kibana-app-arch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, checked on Mac/Chrome, added few minor comments below.
function handleLuceneSyntaxWarning() { | ||
if (!props.query) return; | ||
const { intl, store } = props; | ||
const { query, language } = props.query; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This handleLuceneSyntaxWarning
is quite large and does not deal with rendering per-se, but displays an error message, if one happens. Maybe this function could be lifted out of the rendering path, now every time QueryBarTopRowUI
is rendered it creates a new handleLuceneSyntaxWarning
function. This function really depends only on store
and query
, they could be passed in:
showLuceneSyntaxWarning(props.store, props.query);
BTW, to use internationalisation, we don't need to use injectI18n
HOC, I believe it can be just statically imported import {i18n} from '@kbn/i18n'
.
src/legacy/core_plugins/kibana_react/public/top_nav_menu/top_nav_menu.test.tsx
Show resolved
Hide resolved
src/legacy/core_plugins/kibana_react/public/top_nav_menu/top_nav_menu.tsx
Show resolved
Hide resolved
...k/legacy/plugins/maps/public/connected_components/layer_panel/filter_editor/filter_editor.js
Show resolved
Hide resolved
} | ||
/> | ||
|
||
<KibanaContextProvider |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we could use connected <SearchBar>
component, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the next PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes in Lens LGTM. QueryBarInput
is used in x-pack/legacy/plugins/lens/public/indexpattern_plugin/operations/definitions/filter_ratio.tsx
, using the context there would simplify dependency passing in Lens, but it's probably already on the list :)
Summary
Turn React class components into functional components (to make using context easier) and use KibanaContext for core services
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.For maintainers