dillon1000/react

Commit

[scheduler] Pass didTimeout argument to callbacks (#14931)

As I prepare to refactor the Fiber scheduler, I've noticed some quirks
in our implementation. This PR addressed one of them.

---

There's no reason for a timed out Scheduler callback to check
`shouldYield`, because the value will always be false until the work
has completed. The `didTimeout` argument provides this information to
the callback so it can avoid the redundant checks.

React's existing check for whether a callback has timed out didn't make
any sense, but happened to work anyway. I don't think the wrongness of
the old implementation is observable via React APIs but it's
incoherent regardless.
Browse files
Changed paths4 files
First-parent comparison
M packages/react-noop-renderer/src/createReactNoop.js ModifiedM packages/react-reconciler/src/ReactFiberScheduler.js ModifiedM packages/scheduler/src/Scheduler.js ModifiedM packages/scheduler/src/__tests__/Scheduler-test.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…