-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix delete button not working for static AOI + persist MapboxDraw mod…
…e across reloads (#945) **Related Ticket:** Addressed [942](#942) ### Description of Changes In our `aoisUpdateGeometryAtom` we assumed that each feature added on the map via MapboxDraw is selected. This worked well until we started using the `static_mode` for presets where we disable any interactions attached to them. As a result, we introduced a state mismatch between MapboxDraw (the preset features were marked as not selected) and what we held in our atom in React (the preset features were marked as selected). To fix this in the short-term, two changes were made: - We switch to simple_select mode if static_mode has been selected when using the trash icon - A new url param has been added to track whether a present aoi should be editable or is only there for analysis (static). This will track the correct mode across page reloads ### Notes & Questions About Changes Due to the urgency of the fix that should go out by EOW, I opted for the fix in this PR because I wasn't sure if I'll manage to implement / test a long-term solution without breaking something (the approach nicely outlined [here](#710 (comment)). My understanding of a longer-term solution is as follows: 1. Introduce a `drawStateAtom` that keeps track of various draw modes, features, selected features etc. 2. Add a custom hook `useSyncDraw` that reads/writes to the atom and "syncs" the state between React and MapboxDraw 3. Add event handlers in the custom hook that update the atom as a replacement of the current programmatic way @hanbyul-here @sandrahoang686 If we ticket this for the upcoming sprint/s, I can come up with a draft PR ### Validation / Testing - Validate that hand-drawn and uploaded polygons can be edited and deleted as usual - Validate that presets can also be deleted
- Loading branch information
Showing
6 changed files
with
61 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters