Fix duplicate fetch in Visualize#41204
Conversation
|
Pinging @elastic/kibana-app-arch |
💔 Build Failed |
💔 Build Failed |
|
This overlaps some with this PR from Joe: #41144 Maybe it would be good to combine these efforts since they are solving different parts of the same problem |
|
@lukeelmers Suggestion: I will exclude the editor from my changes and we solve the disabled filters thing in the editor as a part of this PR. |
|
@flash1293 That makes sense to me if it makes sense to @lukasolson :) |
|
@lukeelmers @flash1293 Sounds good, I'll update this PR. |
57cfa68 to
dcd2662
Compare
|
This is ready for another review. |
💔 Build Failed |
src/legacy/core_plugins/kibana/public/visualize/editor/editor.js
Outdated
Show resolved
Hide resolved
|
After talking with @lizozom, I have a couple of fixes to make on this PR, so hold off on review. |
dcd2662 to
a618a3e
Compare
|
@lizozom Could you take another look at this PR? |
💔 Build Failed |
| $scope.$watchGroup(['timeRange', 'filters'], debounce(() => { | ||
| $scope.renderFunction(); | ||
| }, 100)); | ||
| $scope.$watch('timeRange', debounce($scope.renderFunction, 100)); |
There was a problem hiding this comment.
Yay.
But will anything else call renderFunction now?
💔 Build Failed |
| (dateRange && !_.isEqual(dateRange, $scope.timeRange)) | ||
| ); | ||
|
|
||
| if (query && !_.isEqual(query, $state.query)) $state.query = query; |
There was a problem hiding this comment.
do we still need this checks here if w have the checks in embedded_visualize_handler ?
There was a problem hiding this comment.
We still need to check if nothing has changed in order to manually trigger a fetch, but you're right, we don't need to check before we set them. Fixed in cc10e25.
💚 Build Succeeded |
💚 Build Succeeded |
ppisljar
left a comment
There was a problem hiding this comment.
LGTM, tested in chrome linux
💚 Build Succeeded |
* Fix duplicate fetch in Visualize * Don't refetch when disabled filters change * Use query filter fetches observable * Add back in watch on filters * Revert change completely * Update test to include non-disabled filter * Remove unnecessary checks
|
7.x (7.4.0): 59c1eb9 |
…p-metrics-selectall * 'master' of github.com:elastic/kibana: (306 commits) [ML] Adding job overrides to the module setup endpoint (elastic#42946) [APM] Fix missing RUM url (elastic#42940) close socket timeouts without message (elastic#42456) Upgrade elastic/charts to 8.1.6 (elastic#42518) [ML] Delete old AngularJS data visualizer and refactor folders (elastic#42962) Add custom formatting for Date Nanos Format (elastic#42445) [Vega] Shim new platform - vega_fn.js -> vega_fn.js , use ExpressionFunction (elastic#42582) add socket.getPeerCertificate to KibanaRequest (elastic#42929) [Automation] ISTANBUL PRESET PATH is not working fine with constructor(private foo) (elastic#42683) [ML] Data frames: Updated stats structure. (elastic#42923) [Code] fixed the issue that the repository can not be deleted in some cases. (elastic#42841) [kbn-es] Support for passing regex value to ES (elastic#42651) Connect to Elasticsearch via SSL when starting kibana with `--ssl` (elastic#42840) Add Elasticsearch SSL support for integration tests (elastic#41765) Fix duplicate fetch in Visualize (elastic#41204) [DOCS] TSVB and Timelion clean up (elastic#42953) [Maps] [File upload] Fix maps geojson upload hanging on index step (elastic#42623) [APM] Use rounded bucket sizes for transaction distribution (elastic#42830) [yarn.lock] consistent resolve domain (elastic#42969) [Uptime] [Test] Repurpose unit test assertions to avoid flakiness (elastic#40650) ...
Summary
Fixes the behavior in Visualize that refreshing causes multiple search requests.
Prior to this PR, navigating to Visualize and creating a visualization, then hitting refresh (or modifying the query in some manner) would cause multiple requests to be fired off. This PR fixes it by only firing off a fetch request manually when nothing has changed, and otherwise relying on the behavior of visualizations to cause fetches in response to changes within their state.
Here's a GIF showing the behavior beforehand: