Skip to content

docs: fix incorrect startTransition usage in server-functions example - #8159

Closed
DeveloperViraj wants to merge 1 commit into
reactjs:mainfrom
DeveloperViraj:fix/docs-startTransition-example
Closed

DeveloperViraj wants to merge 1 commit into
reactjs:mainfrom
DeveloperViraj:fix/docs-startTransition-example

Conversation

@DeveloperViraj

Copy link
Copy Markdown

Closes #8158

Fix incorrect startTransition usage in docs

The example in the Server Functions page calls a server action inside startTransition, but the state updates after the await aren’t wrapped in a new transition. React’s docs mention that post-await state updates aren’t included automatically, so this updates the snippet to wrap them in another startTransition for correctness.

This brings the example in line with the recommended behavior.

@github-actions

Copy link
Copy Markdown

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! 🙌

@aurorascharff

Copy link
Copy Markdown
Collaborator

Thanks for the contribution! #8538 has been merged and addresses these concerns. If you have further suggestions, please open a new PR and tag me and I’ll take a look!

This branch was successfully deployed

1 active deployment
Preview — 4a6c27e8 Deployed Nov 24, 2025 by vercel[bot]
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.

Is this demo in the React doc an incorrect usage of startTransition?

2 participants