Skip to content

Conversation

@mohit-2003
Copy link

@mohit-2003 mohit-2003 commented Mar 8, 2025

Used useEffect to track isDirty and update setWarnWhen accordingly.

PR Checklist

Please check if your PR fulfills the following requirements:

Bugs / Features

What is the current behavior?

When setting warnWhenUnsavedChanges: true, if the user changes a field but then undo the change and try to navigate to another page, the warn modal pops up even if there aren't no real data changes.

What is the new behavior?

setWarnWhen is now controlled by [isDirty](https://react-hook-form.com/docs/useform/formstate), ensuring that it only shows the warning when the form has been modified.

fixes (#6691)

@mohit-2003 mohit-2003 requested a review from a team as a code owner March 8, 2025 09:26
@changeset-bot
Copy link

changeset-bot bot commented Mar 8, 2025

🦋 Changeset detected

Latest commit: 4c7a748

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Mar 8, 2025

Deploy Preview for refine-doc-live-previews ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 78b3681
🔍 Latest deploy log https://app.netlify.com/sites/refine-doc-live-previews/deploys/67cc0d4f7822b90008cc525d
😎 Deploy Preview https://deploy-preview-6702--refine-doc-live-previews.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@alicanerdurmaz alicanerdurmaz added this to the March 2025 Release milestone Mar 10, 2025
@alicanerdurmaz alicanerdurmaz changed the base branch from main to next March 11, 2025 19:11
@alicanerdurmaz
Copy link
Member

It's look good, Thanks for improving Refine 🙌

Do you have time to write tests?

@BatuhanW BatuhanW removed this from the March 2025 Release milestone Apr 7, 2025
@ritute
Copy link
Contributor

ritute commented Apr 28, 2025

Hey guys, what's the status on this? Need this change in.

@alicanerdurmaz
Copy link
Member

Closed due to inactivity.

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.

[BUG] Warn unsaved changes when there are no changes

4 participants