-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
feat(explore): Show confirmation modal if user exits Explore without saving changes #19993
Conversation
@kgabryje If I do more than one change, then the confirmation is not appearing. The Screen.Recording.2022-05-09.at.11.14.29.AM.mov |
Codecov Report
@@ Coverage Diff @@
## master #19993 +/- ##
==========================================
- Coverage 66.28% 66.28% -0.01%
==========================================
Files 1712 1712
Lines 63968 64003 +35
Branches 6731 6736 +5
==========================================
+ Hits 42404 42424 +20
- Misses 19853 19866 +13
- Partials 1711 1713 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
17742b5
to
ed6e5f9
Compare
Well spotted @michael-s-molina! The problem was that the cleanup function in use effect was being called on each change of its dependencies. I moved the cleanup to a separate useEffect that gets called only on unmount. Also I fixed an old bug that caused the "Altered" pill to stay visible when there was an adhoc metric added and then you added some metric and deleted it immediately (so effectively there was no change, but "Altered" stayed). The reason for that was that in initial form data the adhoc metric is represented by a plain JSON object, but later it's transformed to AdhocMetric instance, so |
/testenv up |
@kgabryje Ephemeral environment spinning up at http://54.244.56.255:8080. Credentials are |
Found two more problems: Screen.Recording.2022-05-11.at.8.47.13.AM.mov |
Thanks for more testing 🙂
|
@michael-s-molina It looks like
On the other hand such flow might be expected - when user changes something in the chart and then sends a link to someone else, that other user shouldn't see the confirmation modal before closing the tab. A similar issue with |
/testenv up |
@kgabryje Ephemeral environment spinning up at http://52.12.219.96:8080. Credentials are |
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
Ephemeral environment shutdown and build artifacts deleted. |
…without saving changes (apache#19993)" This reverts commit ca9766c.
…saving changes (apache#19993) * feat(explore): Show confirmation modal if user exits Explore without saving changes * Fix calling cleanup func unnecessarily * Fix comparing AdhocMetric instance with JSON object * Replace sliceFormData with the initial form data
…without saving changes (apache#19993)" (apache#20092) This reverts commit ca9766c.
SUMMARY
This PR adds a browser confirmation modal (similar to the one that we have in dashboard edit mode) when user makes a change in control panel and then tries to close Explore (either by closing the tab or moving to another page) without clicking Save button.
Currently, that modal is not customizable. However, when we implement Single Page Application in Superset, we'll probably be able to customize the modal when navigating within Superset.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
Changes made without saving:
Changes made and saved:
Changes made and then reverted:
ADDITIONAL INFORMATION