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

Stale default values in Next.js after submitting a form action #797

Open
ChristianIvicevic opened this issue Sep 29, 2024 · 0 comments
Open

Comments

@ChristianIvicevic
Copy link

Describe the bug and the expected behavior

After my server action has resolved and returned a successful response the form items are still showing the previous default values (reverting the newly entered values) despite me calling router.refresh() and fetching the latest data in the parent page and passing it down to the client component that renders the form.

To circumvent this issue I attempted to pass Date.now() as a key prop to my client component to force a full rerender which technically works, but it's noticeable that the form resets shortly to the previous default values and then updates with the new values.

Conform version

v1.2.2

Steps to Reproduce the Bug or Issue

  1. Clone this branch of my fork: https://github.com/ChristianIvicevic/conform/tree/nextjs-stale-defaults
  2. Open the Next.js example and go to the stale page
  3. See the current value read from the database file above the input and how it changes after submitting the form, but the field not updating accordingly

What browsers are you seeing the problem on?

Chrome, Safari

Screenshots or Videos

CleanShot.2024-09-30.at.00.30.54.mp4

Additional context

No response

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

No branches or pull requests

1 participant