Interaction tracking ref-counting bug fixes (WIP)#13590
Interaction tracking ref-counting bug fixes (WIP)#13590bvaughn merged 4 commits intofacebook:masterfrom
Conversation
Details of bundled changes.Comparing: 7bcc077...8c1cfd5 react-dom
react-art
react-test-renderer
react-reconciler
react-native-renderer
schedule
Generated by 🚫 dangerJS |
6a7a89d to
0d0788e
Compare
f53138b to
845fccd
Compare
|
Okay @acdlite, I think this is ready for another look. |
| // Do not remove the current interactions from the priority map on commit. | ||
| // This covers a special case of sync rendering with suspense. | ||
| // In this case we leave interactions in the Map until the suspended promise resolves. | ||
| let preservePendingInteractionsOnCommit: boolean = true; |
There was a problem hiding this comment.
This approach causes some interactions to get lumped together in the case of a suspended+sync root with a high priority interruption, but I think that might be acceptable?
I'd be happy to discuss alternatives!
845fccd to
a98e242
Compare
|
Refactored the suspense logic based on our conversation today, and added some additional tests/fixtures @acdlite ! |
fixtures/tracing/test.html
Outdated
| <div id="root"></div> | ||
| <!-- Load the tracing API before react to test that it's lazily evaluated --> | ||
| <script src="../../build/node_modules/schedule/umd/schedule.development.js"></script> | ||
| <script src="../../build/node_modules/schedule/umd/schedule-tracing.development.js"></script> |
There was a problem hiding this comment.
Needs rebase? Name changed.
There was a problem hiding this comment.
Rebasing on master seems to suggest that master is broken 😄
$ yarn build
BUILDING react.development.js (umd_dev)
OH NOES! react.development.js (umd_dev)
Error: Could not resolve 'scheduler' from /Users/bvaughn/Documents/git/react/packages/react/src/ReactSharedInternals.js
at /Users/bvaughn/Documents/git/react/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.cjs.js:85:23
There was a problem hiding this comment.
Ah, I probably just need to run yarn first huh
There was a problem hiding this comment.
I always forget this silly step 😄
5662c24 to
fe9446f
Compare
| (scheduledInteractions, scheduledExpirationTime) => { | ||
| if ( | ||
| earliestRemainingTimeAfterCommit === NoWork || | ||
| scheduledExpirationTime < earliestRemainingTimeAfterCommit |
There was a problem hiding this comment.
Maybe include a comment explaining why this check works, since it's a bit confusing.
| // This would lead to prematurely calling the interaction-complete hook. | ||
| let suspenseDidTimeout: boolean = false; | ||
| // Instead we wait until the suspended promise has resolved. | ||
| let interactionsHaveBeenSuspended: boolean = false; |
There was a problem hiding this comment.
Suggestion: nextRenderIncludesTimedOutPlaceholder
There was a problem hiding this comment.
This name isn't accurate for the initial null render but I don't care 😁
* Added new (failing) suspense+interaction tests * Add new tracing+suspense test harness fixture * Refactored interaction tracing to fix ref counting bug
* Added new (failing) suspense+interaction tests * Add new tracing+suspense test harness fixture * Refactored interaction tracing to fix ref counting bug
Resolves #13574
Most of the changes in this diff are test code. The actual fix is in fe9446f, within the following files:
ReactFiberSchedulerReactFiberBeginWorkReactFiberUnwindWork