react.dev
react.dev copied to clipboard
docs: fix incorrect startTransition usage in server-functions example
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.
Size changes
📦 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! 🙌