-
Notifications
You must be signed in to change notification settings - Fork 125
Revert "#2247 - Show pending indicator when new unsaved resource is exited (#2269) (#2277) #2284
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
Conversation
…ce is exited (GeoNode#2269) (GeoNode#2277)" This reverts commit af800e5.
Summary of ChangesHello @dsuren1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request is a revert of a previous feature that aimed to display a pending indicator when a new unsaved resource was exited. The changes simplify the internal logic for GeoStory creation and remove the complex system of 'dirty' state checks for various new resource types like maps, dashboards, and geostories. Instead, it introduces a more focused selector, 'isNewMapViewerResource', to determine the dirty state for new map viewer resources, streamlining the overall resource state management. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request reverts the functionality related to showing a pending indicator when a new unsaved resource is exited. While the intention is to remove this specific feature, the implementation of the revert has introduced a critical regression in how 'dirty' states are detected for newly created maps, dashboards, and geostories. The removal of the specialized isNewResourceDirty checks means that content changes in these new resource types will no longer be correctly identified as unsaved, potentially leading to data loss if users navigate away without explicitly saving.
| export const isNewMapViewerResource = (state) => { | ||
| const isNew = state?.gnresource?.params?.pk === "new"; | ||
| const isMapViewer = state?.gnresource?.type === ResourceTypes.VIEWER; | ||
| return isNew && isMapViewer; | ||
| }; | ||
|
|
||
| export const getResourceDirtyState = (state) => { | ||
| if (isNewResourcePk(state)) { | ||
| return isNewResourceDirty(state); | ||
| if (isNewMapViewerResource(state)) { | ||
| return true; | ||
| } |
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.
The removal of isNewResourcePk, isNewMapDirty, isNewDashboardDirty, isNewGeoStoryDirty, and isNewResourceDirty has a critical side effect. These functions were responsible for detecting unsaved changes in newly created resources (maps, dashboards, geostories) before their initial save.
With their removal, and the current implementation of getResourceDirtyState:
- For a new resource (where
state?.gnresource?.initialResourceis empty),initialDatawill be{}. - The
isResourceDataEqualfunction (whichgetResourceDirtyStatenow relies on for non-viewer types) contains the logicif (isEmpty(initialData) || isEmpty(currentData)) { return true; }. - If
initialDatais empty (new resource) andcurrentDatais not empty (user has added content), this condition incorrectly returnstrue, implying no data change (isDataChangedbecomesfalse).
This means that new maps, dashboards, and geostories will not be flagged as 'dirty' even after users have made significant content changes, leading to potential data loss if they attempt to navigate away without saving. This is a critical regression in functionality and user experience.
No description provided.