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

[Maps] fix double fetch when filter pill is added #63024

Merged
merged 7 commits into from
Apr 14, 2020

Conversation

nreese
Copy link
Contributor

@nreese nreese commented Apr 8, 2020

Fixes #59847

#51713 changed the implementation of DataRequest.getMeta but this problem has existed before that change.

Screen Shot 2020-04-08 at 2 40 21 PM

The problem with the updated implementation of DataRequest.getMeta is that it pulled meta from dataMeta when data exists. This caused problems when multiple calls to syncData occurred before stopLoading could be called on the previous syncData call. Below is the path of execution that caused the problem:

  1. First call to syncData calls startLoading. This updates dataMetaAtStart so filters contains [{some new filter}]. stopLoading is not called yet so dataMeta contains [].
  2. The second call to syncData occurs, while the first call was still processing. The canSkipSourceUpdate check gets previous meta from dataMeta so filters is []. canSkipSourceUpdate wrongly passes. canSkipSourceUpdate should have used dataMetaAtStart.

While investigating this PR, I originally thought the problem was with async nature of canSkipSourceUpdate and that the multiple calls to syncData where getting messed up because startLoading had not been called before the next syncData was called. I added isDataSyncActive so that state is set as soon as syncData is called. This logic does not impact the fix and can be remove if its deemed unnecessary.

@nreese nreese added release_note:fix [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation v8.0.0 v7.8.0 labels Apr 8, 2020
@nreese nreese requested a review from thomasneirynck April 8, 2020 20:51
@nreese nreese requested a review from a team as a code owner April 8, 2020 20:51
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-gis (Team:Geo)

@nreese
Copy link
Contributor Author

nreese commented Apr 9, 2020

I am going to remove the isDataSyncActive check from this PR. The logic will preserved in the original commit so we could reuse later if needed.

@nreese
Copy link
Contributor Author

nreese commented Apr 13, 2020

@elasticmachine merge upstream

@nreese
Copy link
Contributor Author

nreese commented Apr 13, 2020

@elasticmachine merge upstream

Copy link
Contributor

@thomasneirynck thomasneirynck left a comment

Choose a reason for hiding this comment

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

tested and works. Thanks for clean fix.

@@ -26,9 +26,13 @@ export class DataRequest {
}

getMeta(): DataMeta {
return this.hasData()
? _.get(this._descriptor, 'dataMeta', {})
: _.get(this._descriptor, 'dataMetaAtStart', {});
Copy link
Contributor

Choose a reason for hiding this comment

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

apart from the bugfix, +1 on the removal of _.get.

x-pack/plugins/maps/public/reducers/map.js Outdated Show resolved Hide resolved
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@nreese nreese merged commit 5aa93be into elastic:master Apr 14, 2020
nreese added a commit to nreese/kibana that referenced this pull request Apr 14, 2020
* [Maps] fix double fetch when filter pill is added

* remove isDataSyncActive

* set dataMetaAtStart to null instead of deleting

Co-authored-by: Elastic Machine <[email protected]>
nreese added a commit that referenced this pull request Apr 14, 2020
* [Maps] fix double fetch when filter pill is added

* remove isDataSyncActive

* set dataMetaAtStart to null instead of deleting

Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Apr 15, 2020
* master: (29 commits)
  Add test:jest_integration npm script (elastic#62938)
  [data.search.aggs] Remove service getters from agg types (AggConfig part) (elastic#62548)
  [Discover] Fix broken setting of bucketInterval (elastic#62939)
  Disable adding conditions when in alert management context. (elastic#63514)
  [Alerting] fixes to allow pre-configured actions to be executed (elastic#63432)
  adding useMemo (elastic#63504)
  [Maps] fix double fetch when filter pill is added (elastic#63024)
  [Lens] Fix missing formatting bug in "break down by" (elastic#63288)
  [SIEM] [Cases] Removed double pasted line (elastic#63507)
  [Reporting] Improve functional test steps (elastic#63259)
  [SIEM][CASE] Tests for server's configuration API (elastic#63099)
  [SIEM] [Cases] Case container unit tests (elastic#63376)
  [ML] Improving parsing of large uploaded files (elastic#62970)
  [ML] Listing global calendars on the job management page (elastic#63124)
  [Ingest][Endpoint] Add Ingest rest api response types for use in Endpoint (elastic#63373)
  Add help text to form fields (elastic#63165)
  [ML] Converts utils Mocha tests to Jest (elastic#63132)
  [Metrics UI] Refactor With* containers to hooks (elastic#59503)
  [NP] Migrate logstash server side code to NP (elastic#63135)
  Clicking cancel in saved query save modal doesn't close it (elastic#62774)
  ...
wayneseymour pushed a commit that referenced this pull request Apr 15, 2020
* [Maps] fix double fetch when filter pill is added

* remove isDataSyncActive

* set dataMetaAtStart to null instead of deleting

Co-authored-by: Elastic Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation release_note:fix v7.8.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Maps] 2 _search requests occur when adding a filter to maps application
4 participants