-
Notifications
You must be signed in to change notification settings - Fork 47.5k
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
Track nested updates per root #10574
Conversation
@@ -25,6 +25,8 @@ export type FiberRoot = { | |||
isScheduled: boolean, | |||
// The work schedule is a linked list. | |||
nextScheduledRoot: FiberRoot | null, | |||
// Track nested commits, to prevent an infinite loop. | |||
nestedUpdateCount: number, |
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 to be added to createFiberRoot below to prevent deopting.
(Maybe we should add a preventExtensions here like we have in createFiber
Object.preventExtensions(this); |
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.
Flow also caught this error, I just forgot to run it
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 has a bug in it. If two roots update every unit of work, in the same order. Then the second one will never reset and eventually throw.
e1bda91
to
4e6a257
Compare
@sebmarkbage Updated |
4e6a257
to
6a65f92
Compare
We track nested updates to simulate a stack overflow error and prevent infinite loops. Every time we commit a tree, we increment a counter. This works if you only have one tree, but if you update many separate trees, it creates a false negative. The fix is to reset the counter whenever we switch trees.
6a65f92
to
883f9f5
Compare
We track nested updates to simulate a stack overflow error and prevent infinite loops. Every time we commit a tree, we increment a counter. This works if you only have one tree, but if you update many separate trees, it creates a false negative.
The fix is to reset the counter whenever we switch trees.