Skip to content

fix: preserve unsaved form builder changes and navigation warnings - #5763

Open
shree-vaths wants to merge 2 commits into
developmentfrom
Shreevaths-Bugfix-3963
Open

shree-vaths wants to merge 2 commits into
developmentfrom
Shreevaths-Bugfix-3963

Conversation

@shree-vaths

@shree-vaths shree-vaths commented Nov 2, 2026 •

Copy link
Copy Markdown

Description

https://docs.google.com/document/d/1zifX1otZPl-VJLQk0sZqZbQFginRytlQ2vKHeQAh_Lo/edit?tab=t.0#bookmark=id.aj5trdyn0c3j

Screenshot 2026-11-02 at 5 45 39 PM

Main changes explained:

  • Updated JobBuilder.jsx

How to test:

  1. check into current branch
  2. do npm install and ... to run this PR locally
  3. Clear site data/cache
  4. log as admin user
  5. go to dashboard→ https://localhost:5173/jobformbuilder
  6. Try to add new field, and go back in navigation.

Screenshots or videos of changes:

PR5761.mov

Note:

Include the information the reviewers need to know.

@netlify

netlify Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit 0b67875
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/6ae92262fefcfe14c2058e87
😎 Deploy Preview https://deploy-preview-5763--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@sonarqubecloud

sonarqubecloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

@vidiyala99 vidiyala99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 (#212529 on 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 beforeunload dialog appears.
  • Save Form: sends one PUT /api/jobforms with formId, title and 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, updateFormFormat writes the posted questions with findByIdAndUpdate, 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.

Image Image

This branch has not been deployed

No deployments
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.

3 participants