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

Handle switching editors with unsaved edits #5096

Merged

Conversation

zlavergne
Copy link

@zlavergne zlavergne commented Apr 13, 2022

There was a problem reported with the RapiD integration when a user would attempt to switch editors from RapiD to iD when the user still had unsaved edits (#5025)

This PR does 3 main things to solve this issue:

  1. Uses the UnsavedMapChangesModalContent component to show an alert if a user still has unsaved edits and tries to switch editors
    tm-rapid_unsaved_edits
  2. To make the actual component switch more performant, I changed how the editor switch is handled. Before, if you switched between RapiD and iD, it would reload the entire page; now it will only reload the single editor components.
  3. To allow (2) to happen, I had to add a RAPIDCONTEXT to the redux store so the contexts don't get confused during the switch since they have slightly different values in their contexts.

Closes #5025

@github-actions github-actions bot added scope: frontend dependencies Pull requests that update a dependency file javascript labels Apr 13, 2022
@sonarcloud
Copy link

sonarcloud bot commented Apr 17, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.9% 0.9% Duplication

@HelNershingThapa
Copy link
Contributor

I've added an error popup that shows up when trying to switch to JOSM. Other than that, I tested the switching process locally, looks good to me @Aadesh-Baral

@HelNershingThapa HelNershingThapa merged commit b70388f into hotosm:develop Apr 17, 2022
@@ -28,6 +28,7 @@
"@turf/transform-scale": "^6.4.0",
"@turf/truncate": "^6.4.0",
"@webscopeio/react-textarea-autocomplete": "^4.7.3",
"RapiD": "facebookincubator/rapid#rapid-v1.1.8-tm.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

Will removing the previously installed RapiD dependency(rapid-v1.1.8_tm) be safe?

Copy link
Author

@zlavergne zlavergne Apr 18, 2022

Choose a reason for hiding this comment

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

It should be totally safe. Making the editors be different components instead of reloading the page required a few changes to RapiD as well. It will basically function as an update to the RapiD dependency.

Copy link
Contributor

Choose a reason for hiding this comment

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

Removed on 27ab132

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file scope: frontend
Projects
No open projects
Status: Deployed to production
Development

Successfully merging this pull request may close these issues.

Error while switching between RapiD and iD editor after RapiD integration.
2 participants