-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[DataViews] Fix checking remote clusters in empty state #110054
Conversation
@@ -156,30 +155,23 @@ const IndexPatternEditorFlyoutContentComponent = ({ | |||
|
|||
// loading list of index patterns | |||
useEffect(() => { | |||
isMounted.current = true; |
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.
(not related to the main fix, but way too minor to extract to separate pr)
I noticed that how this isMounted
was setup is potentially risky because it was set up inside an effect with particular dependencies and then reused in other places which are likely dependent on other things.
Instead of fixing it, I removed it. (no need for it because no race condition or potential memory leaks here) see: https://github.com/facebook/react/pull/22114
@@ -291,10 +277,6 @@ const IndexPatternEditorFlyoutContentComponent = ({ | |||
[http, allowHidden, allSources, type, rollupIndicesCapabilities, searchClient, isLoadingSources] | |||
); | |||
|
|||
useEffect(() => { | |||
reloadMatchedIndices(title); |
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.
@sebelga pointed out that this might be redundant: #109500 (comment)
I tried to remove and indeed don't see any regressions
(not related to the main fix, but way too minor to extract to separate 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.
👍 I'd expect the number of requests to go from 3 to 2 (without the memoizeOnce
you added).
useCallback(() => { | ||
let isMounted = true; | ||
if (!hasDataIndices) | ||
useEffect(() => { |
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 is the main fix [DataViews] Fix checking remote clusters in empty state
We had useCallback
instead of useEffect
by mistake
Pinging @elastic/kibana-app-services (Team:AppServices) |
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.
Code looks good, works well, and thanks for the detailed notes on the changes
…10194) Co-authored-by: Anton Dosov <[email protected]>
…10193) Co-authored-by: Anton Dosov <[email protected]>
Summary
Fix #108930
Also some other minor improvements