Skip to content

Added missing prop to useActionState example#8308

Merged
rickhanlonii merged 2 commits intoreactjs:mainfrom
JakeSaterlay:useactionstate-pending-bug
Feb 17, 2026
Merged

Added missing prop to useActionState example#8308
rickhanlonii merged 2 commits intoreactjs:mainfrom
JakeSaterlay:useactionstate-pending-bug

Conversation

@JakeSaterlay
Copy link
Contributor

In the first example of useActionState the <Total /> component deconstructs an isPending prop, however it is not passed to it in the example. This means that the Updating... text is never shown.

https://react.dev/reference/react/useActionState#adding-state-to-an-action

@github-actions
Copy link

github-actions bot commented Feb 16, 2026

Size changes

Details

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@rickhanlonii
Copy link
Member

Yeah that's intentional, this came up in review. Since there's no optimistic state for the count, having the total be pending is weird. Instead it's just a button that's pending until the API responds, and the other examples after this add more features and a better UX. But you can remove the isPending from Total for this example.

@JakeSaterlay
Copy link
Contributor Author

JakeSaterlay commented Feb 17, 2026

Yeah that's intentional, this came up in review. Since there's no optimistic state for the count, having the total be pending is weird. Instead it's just a button that's pending until the API responds, and the other examples after this add more features and a better UX. But you can remove the isPending from Total for this example.

@rickhanlonii gotcha, thanks for the explanation, have removed isPending from <Total />

@rickhanlonii rickhanlonii merged commit a1cc2ab into reactjs:main Feb 17, 2026
6 checks passed
@rickhanlonii
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments