dillon1000/react

Commit

Use requestIdleCallback timeout to force expiration (#11548)

* Don't call idle callback unless there's time remaining

* Expiration fixture

Fixture that demonstrates how async work expires after a certain interval.
The fixture clogs the main thread with animation work, so it only works if the
`timeout` option is provided to `requestIdleCallback`.

* Pass timeout option to requestIdleCallback

Forces `requestIdleCallback` to fire if too much time has elapsed, even if the
main thread is busy. Required to make expiration times work properly. Otherwise,
async work can expire, but React never has a chance to flush it because the
browser never calls into React.
Browse files
Changed paths18 files
First-parent comparison
A fixtures/expiration/.gitignore AddedA fixtures/expiration/package.json AddedA fixtures/expiration/public/index.html AddedA fixtures/expiration/src/index.js AddedA fixtures/expiration/yarn.lock AddedM packages/react-cs-renderer/src/ReactNativeCS.js ModifiedM packages/react-dom/src/client/ReactDOM.js ModifiedM packages/react-native-renderer/src/ReactNativeFiberRenderer.js ModifiedM packages/react-native-renderer/src/ReactNativeFrameScheduling.js ModifiedM packages/react-noop-renderer/src/ReactNoop.js ModifiedM packages/react-reconciler/src/ReactFiberExpirationTime.js ModifiedM packages/react-reconciler/src/ReactFiberReconciler.js ModifiedM packages/react-reconciler/src/ReactFiberScheduler.js ModifiedM packages/react-rt-renderer/src/ReactNativeRTFiberRenderer.js ModifiedM packages/react-test-renderer/src/ReactTestRenderer.js ModifiedM packages/shared/ReactDOMFrameScheduling.js ModifiedM scripts/jest/environment.js ModifiedM scripts/rollup/results.json Modified
Patch

Files changed

Rendering syntax-highlighted changes…