Skip to content
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

Merged
merged 3 commits into from
Aug 26, 2021

Conversation

Dosant
Copy link
Contributor

@Dosant Dosant commented Aug 25, 2021

Summary

Fix #108930
Also some other minor improvements

@Dosant Dosant changed the title D/2021 08 25 create ip improve [DataViews] Fix checking remote clusters in empty state Aug 25, 2021
@@ -156,30 +155,23 @@ const IndexPatternEditorFlyoutContentComponent = ({

// loading list of index patterns
useEffect(() => {
isMounted.current = true;
Copy link
Contributor Author

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);
Copy link
Contributor Author

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)

Copy link
Contributor

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(() => {
Copy link
Contributor Author

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

@Dosant Dosant added Feature:Data Views Data Views code and UI - index patterns before 8.0 release_note:skip Skip the PR/issue when compiling release notes Team:AppServices v7.15.0 v7.16.0 v8.0.0 bug Fixes for quality problems that affect the customer experience auto-backport Deprecated - use backport:version if exact versions are needed labels Aug 25, 2021
@Dosant Dosant marked this pull request as ready for review August 25, 2021 15:27
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServices)

@Dosant Dosant requested review from mattkime and sebelga and removed request for mattkime August 25, 2021 15:28
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
indexPatternEditor 175.9KB 175.8KB -187.0B

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@mattkime mattkime left a 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

@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.15
7.x

The backport PRs will be merged automatically after passing CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed bug Fixes for quality problems that affect the customer experience Feature:Data Views Data Views code and UI - index patterns before 8.0 release_note:skip Skip the PR/issue when compiling release notes v7.15.0 v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Index Patterns] Fix empty prompts remote cluster check
5 participants