-
Notifications
You must be signed in to change notification settings - Fork 49.8k
Add ref to Offscreen component #25254
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
Changes from 1 commit
a86f80d
d8611ac
a8f7a96
1608017
4320341
c7e962f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1116,6 +1116,14 @@ function commitLayoutEffectOnFiber( | |
| offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; | ||
| offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; | ||
| } | ||
|
|
||
| if (finishedWork.pendingProps.mode === 'manual') { | ||
| if (flags & Ref) { | ||
| safelyAttachRef(finishedWork, finishedWork.return); | ||
| } | ||
| } else if (finishedWork.pendingProps.mode !== undefined) { | ||
| safelyDetachRef(finishedWork, finishedWork.return); | ||
|
||
| } | ||
| } else { | ||
| recursivelyTraverseLayoutEffects( | ||
| finishedRoot, | ||
|
|
||
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.
What if it switches from
manualto something else? We need to schedule a Ref effect to detach it. I think the test you wrote happens to work because it also schedules a Visibility effect during the same render.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 was playing around with this and couldn't come up with a test case to break this.
Anyway, I'm going to remove the condition to only call markRef if mode is manual.