-
Notifications
You must be signed in to change notification settings - Fork 47k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interaction tracking ref-counting bug fixes (WIP) #13590
Interaction tracking ref-counting bug fixes (WIP) #13590
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs rebase? Name changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, poo. Ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I probably just need to run yarn
first huh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I always forget this silly step 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, rebased!
5662c24
to
fe9446f
Compare
(scheduledInteractions, scheduledExpirationTime) => { | ||
if ( | ||
earliestRemainingTimeAfterCommit === NoWork || | ||
scheduledExpirationTime < earliestRemainingTimeAfterCommit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe include a comment explaining why this check works, since it's a bit confusing.
@@ -260,7 +260,8 @@ let interruptedBy: Fiber | null = null; | |||
|
|||
// Do not decrement interaction counts in the event of suspense timeouts. | |||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: nextRenderIncludesTimedOutPlaceholder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
ReactFiberScheduler
ReactFiberBeginWork
ReactFiberUnwindWork