Skip to content

Conversation

@dsuren1
Copy link

@dsuren1 dsuren1 commented Dec 5, 2025

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @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

  • Revert of Previous Feature: This pull request reverts the changes introduced in 'Add a confirmation message when an unsaved Geostory is exited #2247 - Show pending indicator when new unsaved resource is exited', effectively removing the functionality to display a pending indicator in such scenarios.
  • GeoStory Creation Simplification: The logic for creating new GeoStories has been simplified by directly passing the resource configuration to 'setCurrentStory', removing an intermediate variable declaration.
  • Removal of Detailed Dirty State Checks: The detailed 'dirty' state checks for new resources, specifically for maps, dashboards, and geostories (via 'isNewMapDirty', 'isNewDashboardDirty', 'isNewGeoStoryDirty' selectors), have been removed.
  • Introduction of 'isNewMapViewerResource' Selector: A new selector, 'isNewMapViewerResource', has been introduced to specifically identify if a resource is a new map viewer.
  • Refactoring of 'getResourceDirtyState': The 'getResourceDirtyState' function has been refactored to simplify its logic for new resources, now primarily relying on the 'isNewMapViewerResource' selector to determine if a new resource is in a dirty state.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dsuren1 dsuren1 added 5.0.x and removed master labels Dec 5, 2025
@allyoucanmap allyoucanmap merged commit 5315e8b into GeoNode:5.0.x Dec 5, 2025
1 check passed
Copy link

@gemini-code-assist gemini-code-assist bot left a 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.

Comment on lines +340 to 395
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;
}

Choose a reason for hiding this comment

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

critical

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:

  1. For a new resource (where state?.gnresource?.initialResource is empty), initialData will be {}.
  2. The isResourceDataEqual function (which getResourceDirtyState now relies on for non-viewer types) contains the logic if (isEmpty(initialData) || isEmpty(currentData)) { return true; }.
  3. If initialData is empty (new resource) and currentData is not empty (user has added content), this condition incorrectly returns true, implying no data change (isDataChanged becomes false).

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.

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.

2 participants