Skip to content
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

fix(react-hook-form): correctly handle unsaved changes warning (#6691) #6702

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

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
Copy link

changeset-bot bot commented Mar 8, 2025

🦋 Changeset detected

Latest commit: 78b3681

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

This PR includes changesets to release 1 package
Name Type
@refinedev/react-hook-form Patch

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

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.

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.

1 participant