next.js
7e289cb4 - Serve a new dev route as soon as Turbopack announces it

Commit
5 days ago
Serve a new dev route as soon as Turbopack announces it In dev the router works out what it can serve from three pieces of state: the exact path table (appFiles and pageFiles), the dynamic route list, and appPathRoutes, which says whether a path belongs to the App Router or the Pages Router. All three are written by the watchpack handler in setup-dev-bundler.ts. With Turbopack, ADDED_PAGE and REMOVED_PAGE are sent from the entrypoints event instead, and Turbopack gets there before watchpack. So the browser hears about a route, refetches right away, and gets a 404 because the router can't serve it yet. Under load that gap grows to seconds. Now the route table is written from the entrypoints event too, so the state the router serves from and the event that tells the browser to refetch come from the same place. Webpack still writes it from watchpack, where it already announces from inside the same handler and so never had the race. #83829 moved the events but left the state behind. This is the other half.
Author
Committer
Parents
Loading