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

[Bug]: onSubmit from RVF breaks viewTransitions #411

Open
1 of 5 tasks
ZipBrandon opened this issue Dec 19, 2024 · 4 comments
Open
1 of 5 tasks

[Bug]: onSubmit from RVF breaks viewTransitions #411

ZipBrandon opened this issue Dec 19, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@ZipBrandon
Copy link

Which packages are impacted?

  • @rvf/react
  • @rvf/react-router
  • @rvf/zod
  • @rvf/yup
  • zod-form-data

What version of these packages are you using?

"@rvf/core": "^7.0.1",
    "@rvf/react-router": "^7.0.1",
    "@rvf/zod": "^7.0.1",

Please provide a link to a minimal reproduction of the issue.

https://stackblitz.com/edit/github-uwgzmhjv

Steps to Reproduce the Bug or Issue

  1. The sandbox has two different versions that do the same thing. RVF w/ onSubmit added to the Form; and one without onSubmit added to the form.
  2. Click one of the links on the main index page to see. Clicking SUBMIT on the RVF w/ onSubmit won't do the view transition. The nav links will work on the page. RVF w/o onSubmit works as expected performing the basic crossfrade view transition.

Expected behavior

I would expect viewTransitions to work when using RVF and it's submit handler.

Screenshots or Videos

No response

Platform

MacOS, Chrome

Additional context

No response

@ZipBrandon ZipBrandon added the bug Something isn't working label Dec 19, 2024
@airjp73
Copy link
Owner

airjp73 commented Dec 19, 2024

Good callout. I didn't even realize this was a thing now lol. Looks like this should be pretty straightforward to fix. Would you have time to submit a PR for it?

I think it's just a matter of updating the type here and pass through the viewTransition param here.

@ZipBrandon
Copy link
Author

Sure thing! Let me add that.

@airjp73
Copy link
Owner

airjp73 commented Dec 20, 2024

Your PR does appear to have fixed the issue. We'll need to document this, but in order for it to work you need to pass viewTransition: true to the useForm hook rather than the Form component. Since under the hood we use useSubmit rather than the Form component from react-router. It's currently published as 7.0.2-beta.0 until we have documentation (which I could add tomorrow).

@ZipBrandon
Copy link
Author

Thanks for checking that out. I was building my fork and copying the dist over my @rvf/react-router dist directory. I have no idea why I didn't see my changes work in my scrappy test, but the beta package does in fact work. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants