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] clean-up unsaved state check #61535

Merged
merged 1 commit into from
Mar 27, 2020
Merged

Conversation

nreese
Copy link
Contributor

@nreese nreese commented Mar 26, 2020

There is a bug in unsaved state check in the Map application. Follow the steps below to view the bug.

  • Create new map and add Documents layer from web logs sample data.
  • Save and close the layer editor
  • Save the map
  • Open layer editor
  • Configure fill color to use by value styling for any field.
  • Change the color ramp to something other than the default. This is the step that triggers the bug
  • Save and close the layer editor
  • Save the map
  • attempt to leave the application by clicking Maps in the top nav to go to the maps list.
  • The user is presented with a unsaved changes warning even though all changes are saved.

The problem is cause by changes of behavior from categorical styling refactors. Those changes exposed an existing bug in unsaved state check.

Categorical styling changed DynamicColorForm onChange handler to set both customColorRamp and color properties. Yet, either customColorRamp or color is provided when the handler is called so the state contained one of them set to undefined.

Screen Shot 2020-03-26 at 11 17 29 AM

This behavior change exposed an existing bug in the unsaved state check. The unsaved state check compared the current state to state that had been stringified and re-parsed. The problem is that JSON.stringify removes object keys with undefined values so when the stringified and re-parsed version were compared to the current state, they looked different even though they were the same.

Screen Shot 2020-03-26 at 11 17 22 AM

This PR resolves both problems. It avoids setting undefined when customColorRamp or color is not provided . The PR also sends the current state through the JSON.stringify and JSON.parse ringer so the comparison is comparing the same things.

@nreese nreese requested a review from thomasneirynck March 26, 2020 20:26
@nreese nreese requested a review from a team as a code owner March 26, 2020 20:26
@elasticmachine
Copy link
Contributor

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

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

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

@nreese nreese requested review from kindsun and removed request for thomasneirynck March 26, 2020 22:44
Copy link
Contributor

@kindsun kindsun left a comment

Choose a reason for hiding this comment

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

lgtm! Thanks for this fix, works well!

  • tested locally in chrome
  • code review

@nreese nreese merged commit 30bdfed into elastic:master Mar 27, 2020
nreese added a commit to nreese/kibana that referenced this pull request Mar 27, 2020
nreese added a commit to nreese/kibana that referenced this pull request Mar 27, 2020
spalger added a commit that referenced this pull request Mar 27, 2020
spalger added a commit that referenced this pull request Mar 27, 2020
@spalger
Copy link
Contributor

spalger commented Mar 27, 2020

Reverted as it seems this started causing an alert dialog to be open on master, breaking the functional tests that follow it. It's unclear, but it seems the that there might be an unexpected relationship between this change and #61386

Reverted the 7.x backport as well, @nreese is working on resubmitting this.

nreese added a commit to nreese/kibana that referenced this pull request Mar 27, 2020
nreese added a commit that referenced this pull request Mar 30, 2020
* [Maps] clean-up unsaved state check (#61535)

* close layer panel in functional test

* skip vector styling test

* skip saved object management test

* skip all of group 7 tests

* turn back on group 7, skip full screen

* turn on all tests except full screen

* unskip all tests and resolve root problem

Co-authored-by: Elastic Machine <[email protected]>
nreese added a commit to nreese/kibana that referenced this pull request Mar 30, 2020
* [Maps] clean-up unsaved state check (elastic#61535)

* close layer panel in functional test

* skip vector styling test

* skip saved object management test

* skip all of group 7 tests

* turn back on group 7, skip full screen

* turn on all tests except full screen

* unskip all tests and resolve root problem

Co-authored-by: Elastic Machine <[email protected]>
nreese added a commit to nreese/kibana that referenced this pull request Mar 30, 2020
* [Maps] clean-up unsaved state check (elastic#61535)

* close layer panel in functional test

* skip vector styling test

* skip saved object management test

* skip all of group 7 tests

* turn back on group 7, skip full screen

* turn on all tests except full screen

* unskip all tests and resolve root problem

Co-authored-by: Elastic Machine <[email protected]>
nreese added a commit that referenced this pull request Mar 30, 2020
* [Maps] clean-up unsaved state check (#61535)

* close layer panel in functional test

* skip vector styling test

* skip saved object management test

* skip all of group 7 tests

* turn back on group 7, skip full screen

* turn on all tests except full screen

* unskip all tests and resolve root problem

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

Co-authored-by: Elastic Machine <[email protected]>
nreese added a commit that referenced this pull request Mar 30, 2020
* [Maps] clean-up unsaved state check (#61535)

* close layer panel in functional test

* skip vector styling test

* skip saved object management test

* skip all of group 7 tests

* turn back on group 7, skip full screen

* turn on all tests except full screen

* unskip all tests and resolve root problem

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

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants