dillon1000/react

Commit

[Fizz] model fb bundle's external work scheduling explicitly (#36576)

There are parts of Fizz that need to schedule work regardless of whether
the primary rendering pathway is drive externally through performWork.
Historically scheduleWork and later s cheduleMicrotask were noops in
this bundle but it makes it hard to reason about the code because you
cannot be assured that calling scheduleWork will actually result in the
function
ever executing. Now we model this explicitly through config. For builds
that drive work through external calls to performaWork we simply omit
any work scheduling in startWork or pi
ngTask. Now that this is modeled explicitly we can implement
scheduleMicrotask and scheduleWork to actually provide a guarantee that
the callbacks will get invoked.

For now I've implemented these two for the fb build as synchronous
however it is likely that queueMicrotask and setTimeout or similar are
preferred.
Browse files
Changed paths11 files
First-parent comparison
M packages/react-server/src/ReactFizzServer.js ModifiedM packages/react-server/src/ReactServerStreamConfigFB.js ModifiedM packages/react-server/src/forks/ReactFizzConfig.custom.js ModifiedM packages/react-server/src/forks/ReactFizzConfig.dom-edge.js ModifiedA packages/react-server/src/forks/ReactFizzConfig.dom-fb.js AddedM packages/react-server/src/forks/ReactFizzConfig.dom-legacy.js ModifiedM packages/react-server/src/forks/ReactFizzConfig.dom-node.js ModifiedM packages/react-server/src/forks/ReactFizzConfig.dom.js ModifiedM packages/react-server/src/forks/ReactFizzConfig.markup.js ModifiedM packages/react-server/src/forks/ReactFizzConfig.noop.js ModifiedM packages/react-server/src/forks/ReactServerStreamConfig.dom-fb.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…