Repository navigation
fix: preserve unsaved form builder changes and navigation warnings - #5763
Open
shree-vaths wants to merge 2 commits into
Open
shree-vaths wants to merge 2 commits into
shree-vaths wants to merge 2 commits into
Conversation
✅ Deploy Preview for highestgoodnetwork-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
vidiyala99
approved these changes
Nov 3, 2026
vidiyala99
left a comment
Contributor
There was a problem hiding this comment.
Tested 0b67875 on /jobformbuilder in light and dark mode at 1400 px, with the backend on development. My test account doesn't have Manage Job Forms, so I added manageJobForms to the logged-in user in the browser's Redux state only. Every write request was intercepted and answered with a mock 200, so nothing was saved on dev.
Works as described:
- Unsaved banner (screenshots 1 and 2): no banner on load. After I delete a question,
Unsaved changes — click Save Form to keep your changes.appears under the heading. Readable in light mode (#212529on white) and dark mode (white on#1b2a41). - In-app navigation: clicking the Dashboard link shows "You have unsaved changes. Are you sure you want to leave this page?". Cancel keeps me on the builder, and the deleted question stays deleted.
- Browser Back: shows the same prompt. Cancel keeps both the URL and the page on
/jobformbuilder. - Reload / close tab: the native
beforeunloaddialog appears. - Save Form: sends one
PUT /api/jobformswithformId,titleand the full question list (the deleted one is gone), and shows "Form saved successfully!". The banner then clears, and Back leaves with no prompt. - On
development,updateFormFormatwrites the postedquestionswithfindByIdAndUpdate, so saving the local edits does persist them. - Lint, tests and SonarCloud pass.
Non-blocking:
- The PR description doesn't mention a behaviour change. Delete, edit, add and reorder used to save to the server immediately. Now they stay local until Save Form (the delete sent no request in my test). That fits the title, but please add it to the description so testers know.
- Merge order with #5761 and #5764. All three edit
JobFormbuilder.jsx(deleteField, the state block and the end of the JSX). Whichever merges second needs a rebase. #5761's "This change is saved immediately." text won't be true after this PR. - The banner is plain body text, far from the Save Form button. A warning colour or an icon would make it easier to notice. Optional.
Approving.
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
https://docs.google.com/document/d/1zifX1otZPl-VJLQk0sZqZbQFginRytlQ2vKHeQAh_Lo/edit?tab=t.0#bookmark=id.aj5trdyn0c3j
Main changes explained:
How to test:
npm installand...to run this PR locallyScreenshots or videos of changes:
PR5761.mov
Note:
Include the information the reviewers need to know.