-
Notifications
You must be signed in to change notification settings - Fork 11k
fix: implemented saving modal instead of discarding #25156
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
base: main
Are you sure you want to change the base?
Conversation
|
@Pallava-Joshi is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
|
Hey there and thank you for opening this pull request! 👋🏼 We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Details: |
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.
No issues found across 2 files
| const hasStructuralFieldChanges = () => { | ||
| const saved = form.fields ?? []; | ||
| const current = formContext.getValues("fields") ?? []; | ||
| if (saved.length !== current.length) return true; | ||
| for (let i = 0; i < saved.length; i++) { | ||
| if (saved[i]?.id !== current[i]?.id) return true; | ||
| } | ||
| return false; |
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.
what does structural field change mean?
| return false; | ||
| }; | ||
|
|
||
| const hasUnsaved = formContext.formState.isDirty || hasStructuralFieldChanges(); |
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.
If possible we should try to just use formContext.formState.isDirty here. We also using isDirty pattern everywhere in our codebase. If something in form has been changed then isDirty must be true.
What does this PR do?
Fixes #25155
Screen.Recording.2025-11-14.at.2.58.03.PM.mov
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Summary by cubic
Adds a save-confirmation modal when leaving the Routing Form editor for Route Builder, so unsaved changes are preserved instead of discarded.
Written for commit d2a8956. Summary will update automatically on new commits.