-
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
[embeddable] centralize should fetch embeddable observable logic #151799
Conversation
…-ref HEAD~1..HEAD --fix'
…-ref HEAD~1..HEAD --fix'
…-ref HEAD~1..HEAD --fix'
@elasticmachine merge upstream |
Pinging @elastic/kibana-presentation (Team:Presentation) |
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.
Tested Lens embeddable—works great. Thanks
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 review + tested locally in Chrome with dashboard containing a map and lens embeddable. Tested that the map and lens reload when an enabled, pinned, negated etc filter is changed, that they don't reload when a disabled filter is changed, and that only the lens reloads on change of a filter controlled by the map.
Great call to centralize the should refetch observable I left a few questions and some ideas for followups to clean this even further. LGTM!
src/plugins/embeddable/public/lib/filterable_embeddable/should_fetch.tsx
Outdated
Show resolved
Hide resolved
src/plugins/embeddable/public/lib/filterable_embeddable/should_fetch.tsx
Show resolved
Hide resolved
src/plugins/embeddable/public/lib/filterable_embeddable/should_fetch.tsx
Show resolved
Hide resolved
shouldFetch$<MapEmbeddableInput>(this.getUpdated$(), () => { | ||
return { | ||
...this.getInput(), | ||
filters: this._getFilters(), |
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.
It looks like these filters are only different from the ones on input due to filtering out disabled filters & those that are controlledBy
this map.
It seems like disabled filters are already filtered out by onlyDisabledFiltersChanged
- I wonder if we could get rid of this special treatment by adding a excludeControlledBy
argument to FilterCompareOptions
?
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.
Interesting idea and something to consider for future refactors.
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Any counts in public APIs
Async chunks
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
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! Great to centralize the fetching logic!
code review and tested in chrome
…stic#151799) Fixes elastic#151223 and elastic#151128 PR does the following 1) creates `shouldFetch$` method that centralizes logic for checking when an embeddable should fetch. 2) updates Lens and Maps embeddable to use `shouldFetch$` 3) Adds unit tests for Maps embeddable to capture behavior of unique edge cases --------- Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit afb251c)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
#151799) (#152838) # Backport This will backport the following commits from `main` to `8.7`: - [[embeddable] centralize should fetch embeddable observable logic (#151799)](#151799) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Nathan Reese","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-03-01T01:47:48Z","message":"[embeddable] centralize should fetch embeddable observable logic (#151799)\n\nFixes #151223 and\r\nhttps://github.com//issues/151128\r\n\r\nPR does the following\r\n1) creates `shouldFetch# Backport This will backport the following commits from `main` to `8.7`: - [[embeddable] centralize should fetch embeddable observable logic (#151799)](#151799) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT method that centralizes logic for checking\r\nwhen an embeddable should fetch.\r\n2) updates Lens and Maps embeddable to use `shouldFetch# Backport This will backport the following commits from `main` to `8.7`: - [[embeddable] centralize should fetch embeddable observable logic (#151799)](#151799) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT \r\n3) Adds unit tests for Maps embeddable to capture behavior of unique\r\nedge cases\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"afb251c624552024076ae75890de9c7d5f4458f0","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Visualizations","Feature:Embedding","Team:Presentation","release_note:skip","backport:skip","Feature:Maps","v8.8.0"],"number":151799,"url":"https://github.com/elastic/kibana/pull/151799","mergeCommit":{"message":"[embeddable] centralize should fetch embeddable observable logic (#151799)\n\nFixes #151223 and\r\nhttps://github.com//issues/151128\r\n\r\nPR does the following\r\n1) creates `shouldFetch# Backport This will backport the following commits from `main` to `8.7`: - [[embeddable] centralize should fetch embeddable observable logic (#151799)](#151799) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT method that centralizes logic for checking\r\nwhen an embeddable should fetch.\r\n2) updates Lens and Maps embeddable to use `shouldFetch# Backport This will backport the following commits from `main` to `8.7`: - [[embeddable] centralize should fetch embeddable observable logic (#151799)](#151799) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT \r\n3) Adds unit tests for Maps embeddable to capture behavior of unique\r\nedge cases\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"afb251c624552024076ae75890de9c7d5f4458f0"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/151799","number":151799,"mergeCommit":{"message":"[embeddable] centralize should fetch embeddable observable logic (#151799)\n\nFixes #151223 and\r\nhttps://github.com//issues/151128\r\n\r\nPR does the following\r\n1) creates `shouldFetch# Backport This will backport the following commits from `main` to `8.7`: - [[embeddable] centralize should fetch embeddable observable logic (#151799)](#151799) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT method that centralizes logic for checking\r\nwhen an embeddable should fetch.\r\n2) updates Lens and Maps embeddable to use `shouldFetch# Backport This will backport the following commits from `main` to `8.7`: - [[embeddable] centralize should fetch embeddable observable logic (#151799)](#151799) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT \r\n3) Adds unit tests for Maps embeddable to capture behavior of unique\r\nedge cases\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"afb251c624552024076ae75890de9c7d5f4458f0"}}]}] BACKPORT--> Co-authored-by: Nathan Reese <[email protected]>
…stic#151799) Fixes elastic#151223 and elastic#151128 PR does the following 1) creates `shouldFetch$` method that centralizes logic for checking when an embeddable should fetch. 2) updates Lens and Maps embeddable to use `shouldFetch$` 3) Adds unit tests for Maps embeddable to capture behavior of unique edge cases --------- Co-authored-by: kibanamachine <[email protected]>
Fixes #151223 and #151128
PR does the following
shouldFetch$
method that centralizes logic for checking when an embeddable should fetch.shouldFetch$