Skip to content
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

[v9] fix: handle container effects on completed trees, track instance visibility #2483

Merged

Conversation

CodyJasonBennett
Copy link
Member

@CodyJasonBennett CodyJasonBennett commented Sep 2, 2022

Depends on #2465, fixes #2250.

Moves attach and interactivity to handleContainerEffects which will fire when trees are linked and finalized. This ensures that effects are not duplicated due to suspense and complete outside of commit, so we're never late and present an incomplete tree.

I've updated the CSB to highlight the intricacies throughout the reconciler lifecycle: https://codesandbox.io/s/scrgbc. Should fire attach (uuid must match ref and thus be current), useLayoutEffect (ensures the view is completed before presenting), then the parent is reconstructed from scratch so children will detach and attach.

I've also added an isHidden property to instances to make sure we don't handle attach or detach for instances that weren't hidden by React. This could similarly cause duplication.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 2, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 39763ce:

Sandbox Source
example Configuration
Attach Suspense - v9 PR
append-bug Issue #2250

@CodyJasonBennett CodyJasonBennett changed the title experiment: handle attach with containers, de-dup attach on hide/unhide experiment: handle attach with containers, track instance visibility Sep 2, 2022
@CodyJasonBennett CodyJasonBennett changed the title experiment: handle attach with containers, track instance visibility experiment: handle container effects on completed trees, track instance visibility Sep 2, 2022
@CodyJasonBennett CodyJasonBennett changed the title experiment: handle container effects on completed trees, track instance visibility fix: handle container effects on completed trees, track instance visibility Sep 2, 2022
@CodyJasonBennett CodyJasonBennett marked this pull request as ready for review September 2, 2022 23:01
@CodyJasonBennett CodyJasonBennett changed the title fix: handle container effects on completed trees, track instance visibility [v9] fix: handle container effects on completed trees, track instance visibility Sep 2, 2022
@CodyJasonBennett CodyJasonBennett merged commit bcf1450 into refactor/instance-descriptors Sep 2, 2022
@CodyJasonBennett CodyJasonBennett deleted the experiment/attach-containers branch September 2, 2022 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant