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

Next Server Actions example doesn't account for pending status of server action #1018

Closed
icopp opened this issue Nov 13, 2024 · 3 comments
Closed
Labels

Comments

@icopp
Copy link

icopp commented Nov 13, 2024

Describe the bug

When submitting a form, only the client-side state is taken into account for isSubmitting, canSubmit, etc. The server pending state isn't considered at all.

Your minimal, reproducible example

https://stackblitz.com/edit/tanstack-form-uwg7fh

Steps to reproduce

In the given example, submit the form and see that the "Pending" label changes, even while the "Submit" label and button status don't.

Expected behavior

The form should be treated as submitting whenever the server action isPending flag is true.

How often does this bug happen?

Always

Screenshots or Videos

No response

Platform

n/a (all platforms)

TanStack Form adapter

None

TanStack Form version

0.35.0

TypeScript version

5.4.5

Additional context

No response

@crutchcorn crutchcorn added the bug label Nov 25, 2024
@crutchcorn
Copy link
Member

The form should be treated as submitting whenever the server action isPending flag is true.

This isn't possible without increasing how tied we are to Next.js and RSCs specifically. After re-evaluating this isn't a bug and it can be remedied in user-land by a simple isSubmitting && formState. Closing

@gshahbazian
Copy link

If this is the answer then should the example be updated to match?

@DiederikvandenB
Copy link

DiederikvandenB commented Mar 19, 2025

This isn't possible without increasing how tied we are to Next.js and RSCs specifically.

I understand and respect this. However, I do think that the name isSubmitting is then maybe not the best. Wouldn't isValidating make more sense?

Because the examples, like @gshahbazian says, do not show us this, it took me a while to understand why my loading state was not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants