dillon1000/react
Commit
Browse files Use setTimeout to schedule work on the server in Edge environments (#26348)
We rely heavily on being able to batch rendering after multiple fetches etc. have completed on the server. However, we only do this in the Node.js build. Node.js `setImmediate` has the exact semantics we need. To be after the current cycle of I/O so that we can collect after all those I/O events already in the queue has been processed. This doesn't exist in standard browsers, so we ended up not using it there. We could've used `setTimeout` but that risks being throttled which would severely negatively affect the performance so we just did it synchronously there. We probably could just use the `scheduler` there. Now we have a separate build for Edge where `setTimeout(..., 0)` actually behaves like `setImmediate` which is what we want. So we can just use that in that build. @Jarred-Sumner not sure what you want for Bun.
Changed paths3 files
First-parent comparisonpackages/react-server-dom-webpack/src/__tests__/ReactFlightDOMEdge-test.js ModifiedM packages/react-server/src/ReactServerStreamConfigEdge.js ModifiedM packages/react/src/__tests__/ReactFetchEdge-test.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…