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
Fix global search crash on missing tag #159196
Conversation
…x-nav-search-crash
@elasticmachine merge upstream |
Pinging @elastic/appex-sharedux (Team:SharedUX) |
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. I left a small note about updating the unit test, but I won't block merge because of it.
@elasticmachine merge upstream |
@tsullivan, I didn't see the note |
@elasticmachine merge upstream |
const option = resultToOption(input, [], getTag); | ||
expect(option.append).toMatchInlineSnapshot(` | ||
<ResultTagList | ||
searchTagIds={Array []} | ||
tags={ | ||
Array [ | ||
Object { | ||
"color": "#000000", | ||
"description": "Known", | ||
"id": "known", | ||
"name": "Known", | ||
}, | ||
] | ||
} | ||
/> | ||
`); |
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.
I suggest adding a spy on the console to verify the message that is logged:
const logSpy = jest.spyOn(console, 'warn').mockImplementation(() => {}); // added
const option = resultToOption(input, [], getTag); // current code
// ... more current code
expect(logSpy).toBeCalledWith(
'SearchBar: Tag with id "unknown" not found. Tag "unknown" is referenced by the search result "dashboard:id". Skipping displaying the missing tag.'
); // added
…/kibana into d/2023-06-07-fix-nav-search-crash
…x-nav-search-crash
💚 Build Succeeded
Metrics [docs]Page load bundle
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
## Summary Close elastic#157682, elastic#159152 Fixes global search component crashing on the missing tag. Ideally this should never happen as data is inconsistent, but we also shouldn't just crash the component. Adds a console warning in case hitting this edge case. (cherry picked from commit aa4a5e5)
# Backport This will backport the following commits from `main` to `8.8`: - [Fix global search crash on missing tag (#159196)](#159196) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Anton Dosov","email":"anton.dosov@elastic.co"},"sourceCommit":{"committedDate":"2023-06-09T10:27:41Z","message":"Fix global search crash on missing tag (#159196)\n\n## Summary\r\n\r\nClose #157682 global search component crashing on the missing tag. Ideally this\r\nshould never happen as data is inconsistent, but we also shouldn't just\r\ncrash the component.\r\n\r\nAdds a console warning in case hitting this edge case.","sha":"aa4a5e5cc4459be3929f02d63ebb679448a531bd","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:Navigational Search","Team:SharedUX","backport:prev-minor","v8.9.0"],"number":159196,"url":"#159196 global search crash on missing tag (#159196)\n\n## Summary\r\n\r\nClose #157682 global search component crashing on the missing tag. Ideally this\r\nshould never happen as data is inconsistent, but we also shouldn't just\r\ncrash the component.\r\n\r\nAdds a console warning in case hitting this edge case.","sha":"aa4a5e5cc4459be3929f02d63ebb679448a531bd"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"#159196 global search crash on missing tag (#159196)\n\n## Summary\r\n\r\nClose #157682 global search component crashing on the missing tag. Ideally this\r\nshould never happen as data is inconsistent, but we also shouldn't just\r\ncrash the component.\r\n\r\nAdds a console warning in case hitting this edge case.","sha":"aa4a5e5cc4459be3929f02d63ebb679448a531bd"}}]}] BACKPORT--> Co-authored-by: Anton Dosov <anton.dosov@elastic.co>
## Summary Close elastic#157682, elastic#159152 Fixes global search component crashing on the missing tag. Ideally this should never happen as data is inconsistent, but we also shouldn't just crash the component. Adds a console warning in case hitting this edge case.
Summary
Close #157682, #159152
Fixes global search component crashing on missing tag. Ideally this should never happen as data is inconsistent, but we also shouldn't just crash the component.
Adds a console warning in case hitting this edge case.