Wait for Server Action HMR before asserting state by devjiwonchoi · Pull Request #98267 · vercel/next.js · GitHub
Skip to content

Wait for Server Action HMR before asserting state - #98267

Draft
devjiwonchoi wants to merge 1 commit into
canaryfrom
jiwon/synchronize-action-hmr-test
Draft

Wait for Server Action HMR before asserting state#98267
devjiwonchoi wants to merge 1 commit into
canaryfrom
jiwon/synchronize-action-hmr-test

Conversation

@devjiwonchoi

Copy link
Copy Markdown
Member

Why?

The Server Action HMR test can invoke the action before Webpack finishes applying the update. Because the retry also repeats the click, several action requests can overlap with Fast Refresh. A full reload then resets client state and produces 1000 instead of preserving state.

How?

Register the existing HMR completion callback before patching the action and wait for it to finish. Invoke the updated action once, then retry only the exact 1001 state assertion. This keeps the state-preservation coverage and changes no runtime code.

Wait for the HMR callback before invoking the updated action, then retry only the state assertion to avoid overlapping requests.
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

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

Successfully merging this pull request may close these issues.

1 participant