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
Run React Refresh at vite:afterUpdate instead of after a fixed 16 ms #1565
So every Fast Refresh edit waits at least 16 ms after its modules have run.
We see it in TanStack Router, which waits for the pass through __registerBeforePerformReactRefresh before applying a route edit: an edit of only a route's loader went from 16.9 to 36.8 ms save-to-DOM when we started waiting (1,485-route app).
Suggested solution
By the time the client emits vite:afterUpdate, every module of the payload has run its accept callback, so every validateRefreshBoundaryAndEnqueueUpdate call of that update has been made. Flush there, and keep the timer for enqueues outside an update:
So I looked into this, and we could do something about this like this.
But the issue is that it as been so stable that some of it's code is actually hardcoded into rolldown. We are trying to remove React specific things from rolldown/oxc (with oxc-transform-react) but that's an ongoing process and could lead to perf regression for dev startup time for big apps.
I think we can add a flag to the plugin in rolldown to generate the new code. Then, plugin-react can enable that option while making the refresh-runtime expose both validateRefreshBoundaryAndEnqueueUpdate and validateRefreshBoundary+flushPendingRefresh. That should work with old Vite/Rolldown versions and new versions.
Activity
ArnaudBarre commentedon Nov 15, 2026
So I looked into this, and we could do something about this like this.
But the issue is that it as been so stable that some of it's code is actually hardcoded into rolldown. We are trying to remove React specific things from rolldown/oxc (with oxc-transform-react) but that's an ongoing process and could lead to perf regression for dev startup time for big apps.
cc @sapphi-red FYI
sapphi-red commentedon Nov 16, 2026
I think we can add a flag to the plugin in rolldown to generate the new code. Then, plugin-react can enable that option while making the refresh-runtime expose both
validateRefreshBoundaryAndEnqueueUpdateandvalidateRefreshBoundary+flushPendingRefresh. That should work with old Vite/Rolldown versions and new versions.