You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Dev: serialize and coalesce route-rescan work #5083
Next.js now serializes development route rescans triggered by file-watcher events. While a scan is active, later events collapse into one trailing scan that reads the latest filesystem state. This prevents older asynchronous scans from interleaving shared route-state mutations or publishing after a newer scan.
Impact on vinext
vinext scans App Router and Pages Router files during development and updates routing/HMR state asynchronously. Its watcher lifecycle must ensure route scans do not overlap and must run one trailing rescan after changes that arrive during an active scan. Otherwise removed routes, route definitions, middleware/proxy matchers, interception rewrites, or type/HMR updates can be restored from stale state.
Acceptance criteria
Ensure only one development route scan can mutate or publish route state at a time.
Coalesce watcher events received while a scan is running into exactly one trailing scan.
Ensure the trailing scan reads the latest filesystem state.
Release the serialized runner after both rejected and synchronously thrown scans, without swallowing errors.
Add focused coverage for no overlap, trailing-scan coalescing, latest-state publication, and error recovery.
Add a development regression for rapid route deletion/restoration or interception changes.
Activity