next.js
611fe639 - Development: Remove matchers.reload() on each request (#83829)

Commit
96 days ago
Development: Remove matchers.reload() on each request (#83829) ## What? Re-apply #83720. It was reverted because of tests flaking significantly more often. Dug into this with @mischnic and @sokra yesterday and we found that it's a race condition because of the two separate watchers. In `setup-dev-bundler.ts` there's a Watchpack instance and Turbopack has it's own watcher. The specific case where it caused flakes is when the watchpack aggregate event runs before Turbopack's watcher has emitted a change event. Since the watchpack aggregate callback emits `ADDED_PAGE` / `REMOVED_PAGE` over the websocket it would end up triggering the browser `location.reload()` too early, before the Turbopack side has the updated list of routes. The right solution is to move the `matchers.reload()` and `ADDED_PAGE` / `REMOVED_PAGE` events to where Turbopack emits that the list of routes (entrypoints) has updated.
Author
Parents
Loading