[Hotfix] Clear saved query crashes kibana on Discover in some cases#63554
[Hotfix] Clear saved query crashes kibana on Discover in some cases#63554Dosant merged 3 commits intoelastic:masterfrom
Conversation
| //reset filters and query string, remove savedQuery from state | ||
| // remove savedQueryId from state | ||
| const state = { | ||
| ...appStateContainer.getState(), |
There was a problem hiding this comment.
This what was causing a "loop". Since as a hot fix I just moved localStorage.get('kibana.userQueryLanguage') into search_bar logic, this additional logic is not needed anymore.
query and filters are anyway synced outside of this
If I'd leave this code as is - the loop still will be fixed just by other changes. See the commit: 12c9c56
|
|
||
| // fails: bug in discover https://github.com/elastic/kibana/issues/63561 | ||
| // unskip this test when bug is fixed | ||
| it.skip('changing language removes saved query', async () => { |
There was a problem hiding this comment.
Noticed different bug, a bit related but with lower severity. created an issue: #63561
|
Pinging @elastic/kibana-app-arch (Team:AppArch) |
kertal
left a comment
There was a problem hiding this comment.
Code LGTM from KibanaApp/Discover side, tested locally in Chrome 80, no more endless looping, thx!
|
I'm having some trouble producing the problem and I'm therefore uncertain if this fixes it. @Dosant perhaps we should pair, seems like it should be easy to reproduce. |
|
Was able to reproduce the problem and verify that this fixes the problem. Thanks @Dosant |
…astic#63554) * actual hotfix * clean up redundant code * add functional test
…astic#63554) * actual hotfix * clean up redundant code * add functional test
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* master: (56 commits) [i18n] Update CODEOWNERS (elastic#63354) add platform team definition of done (elastic#59993) [SIEM] move away from Joi for importing/exporting timeline (elastic#62125) Fix discover preserve url (elastic#63580) [alerting] Adds an alertServices mock and uses it in siem, monitoring and uptime (elastic#63489) Closes elastic#63109 for Service Map by resetting edges styles for the selected node (elastic#63655) MIgrated index_header to react (elastic#63490) Index pattern management UI -> TypeScript and New Platform Ready (indexed_fields_table) (elastic#63364) [SIEM] [Cases] Insert timeline and reporters/tags in table bug fixes (elastic#63642) [Reporting] Make usable default element positions (elastic#63191) [Reporting] Switch Serverside Config Wrapper to NP (elastic#62500) [Reporting] Add "warning" status as an alternate type of completed job (elastic#63498) Split action types into own page (elastic#63516) [Lens] Only show copy on save for previously saved docs (elastic#63535) Update README.md (elastic#63622) Bugfix clear saved query crashes kibana on Discover in some cases (elastic#63554) Add uptime CODEOWNER entries. (elastic#63616) [ML] Extract apiDoc params from the schema definitions (elastic#62933) Fix alerting documentation encryption key requirement (elastic#63512) Fix CODEOWNERS and sass lint paths (elastic#63552) ...
Summary
This hot fixes bug in Discover when clearing "Saved query". #63505
Bug is reproduced reliably in any environment if preferred query language in uiSettings is different from saved query language in localStorage. :
To reproduce:
The bug causing the loop is happening on integration level between discover and search_bar
src/plugins/data/public/ui/search_bar/lib/use_saved_query.ts. When clearing saved_query search_bar tried to switch query to value from uiSettings, but discover then updated it to the value from localStorage. Then there is a loop condition caused by this and this has to be fixed separately in a generic way. I'll create a tech-debt ticket.I don't believe this is a proper fix. It is just the simplest and with the least amount of risk one.
This is the commit with the actual fix: 12c9c56
TODO:
connected_search_barto not cause infinite loops depending on inputs - this would be a proper fix. We need to increase test coverage focused on redundant renderings. Statefull <SearchBar/> hardening #63675Checklist
Delete any items that are not applicable to this PR.
For maintainers