Skip to content

Guard against losing project description changes#311

Open
dibyanshu-pal-kushwaha wants to merge 2 commits intoStatTag:masterfrom
dibyanshu-pal-kushwaha:Guard-against-losing-project-description-text
Open

Guard against losing project description changes#311
dibyanshu-pal-kushwaha wants to merge 2 commits intoStatTag:masterfrom
dibyanshu-pal-kushwaha:Guard-against-losing-project-description-text

Conversation

@dibyanshu-pal-kushwaha
Copy link

@dibyanshu-pal-kushwaha dibyanshu-pal-kushwaha commented Feb 4, 2026

Description: This PR Prevents users from accidentally losing unsaved edits to the Project Description when navigating between projects.

Fixes : #284

Changes :

  1. About.js : Added a useEffect hook to track the "dirty" state of the description fields . It now notifies the parent component whenever unsaved changes exist.
  2. Project.js : Updated to pass the onDirtyStateChange callback from the main page down to the About component.
  3. ProjectPage.js : Tracks unsaved changes and prompts “Discard Changes?” before switching projects & prevented reloading by ignoring clicks on the already selected project.
  4. Added material UI Dialog.

Screenshots :
Before Editing the current project :
s4

After Editing , trying to click another project then this Discards Change Card appears for confirmation :
c2

Steps to Test :

  1. Launch the application and select the project.
    2.Click on the Edit the details of the Project -> Trying editing the description.
    3.Now try to click onto other projects , a Discard Changes Card will pop up to confirm the changes done by you.
    4.When you cancel it , your changes remains there and you do not move to the other project.

Clearly we are able to solve the issue of losing the project description changes accidentally by opening other projects.

Copy link
Contributor

@lrasmus lrasmus left a comment

Choose a reason for hiding this comment

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

One minor UI change, but this appears to handle very well the situation where a user clicks on another project and has pending changes!

open={this.state.showDirtyConfirmation}
onClose={this.handleCancelSwitch}
>
<DialogTitle>Discard Changes?</DialogTitle>
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor UI change - the dialog title needs to be manually adjusted:

Image

We had to do this in another dialog too, just setting the style to white.

Copy link
Author

@dibyanshu-pal-kushwaha dibyanshu-pal-kushwaha Feb 4, 2026

Choose a reason for hiding this comment

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

@lrasmus , I fixed this in the latest commit.

c2

Choose a reason for hiding this comment

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

@lrasmus , Please review this pr and help me to fix it if needed sir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Guard against losing project description text

2 participants