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

Fix double fetch errors #54701

Merged
merged 3 commits into from Jan 16, 2020
Merged

Conversation

flash1293
Copy link
Contributor

@flash1293 flash1293 commented Jan 14, 2020

Fixes #54526

Additionally to the problem described in the ticket this also fixes the double fetch problem when adding/removing filter pills.

There are multiple ways fetch calls can reach the discover app:

  • From a global state (e.g. timefilter) that got updated by something external
  • From a react callback because the user changed timefilter/query in the UI
  • From a query migration happening in a scope watcher

This PR attempts to fix those by only triggering a fetch if the time range doesn't change.

TODO:

  • Fix double fetch on filter change. This is caused by src/plugins/data/public/query/filter_manager/lib/mappers/map_phrase.ts mapping a new formatter function into the filter object which causes the object to be non-equal to the current one on each update. Not sure what's the best way to fix this, plus we should have some way of testing this as I remember that we had a similar case in the past. cc @lizozom

@flash1293
Copy link
Contributor Author

@lizozom Is the filter problem something we should solve in that PR or do you want me to open a separate issue?

@lizozom
Copy link
Contributor

lizozom commented Jan 14, 2020

@flash1293 just create an issue and assign to me.

Copy link
Contributor

@lizozom lizozom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scary, but works :-D

@flash1293 flash1293 marked this pull request as ready for review January 15, 2020 08:19
@flash1293 flash1293 requested a review from a team January 15, 2020 08:19
@flash1293 flash1293 added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Jan 15, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@flash1293
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@flash1293 flash1293 merged commit c8c03e4 into elastic:master Jan 16, 2020
@flash1293 flash1293 deleted the fix/discover-double-fetch branch January 16, 2020 14:41
flash1293 added a commit to flash1293/kibana that referenced this pull request Jan 16, 2020
flash1293 added a commit that referenced this pull request Jan 16, 2020
jkelastic pushed a commit to jkelastic/kibana that referenced this pull request Jan 17, 2020
flash1293 added a commit to flash1293/kibana that referenced this pull request Jan 27, 2020
flash1293 added a commit that referenced this pull request Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Discover Discover Application release_note:fix Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.6.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Discover: Double fetch on changing time filter
5 participants