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

Components: Handle multiple Slots by same name #12882

merged 1 commit into from Jan 22, 2019


None yet
3 participants
Copy link

aduth commented Dec 14, 2018

Fixes #12355
Alternative to: #12580

This pull request seeks to resolve an issue where multiple Slot instances using the same name can conflict:

  • Previously, both would render the Fills, except when bubblesVirtually is true, since it uses createPortal to render to a single node
    • Now, only the last-registered Slot will render the Fills
  • Previously, if an earlier-registered Slot unmounted, it would cause the last-registered Slot to become destroyed
    • Now, a slot is only removed from context if it is the last-registered instance

Testing instructions:

Repeat Steps to Reproduce from #12355, verifying that no duplicate toolbar is shown.

Verify there are no regressions in the behavior of Slot / Fill, both for bubblesVirtually true (e.g. Popovers) and false (e.g. BlockToolbars).

Ensure unit tests pass:

npm run test-unit

@aduth aduth requested a review from johngodley Dec 14, 2018

@aduth aduth force-pushed the update/handle-multi-mounted-slot branch from 6294dda to bdba6b8 Jan 3, 2019

Copy link

johngodley left a comment

I've been unable to reproduce the original problem on master. I guess something changed that's affected the order in which block duplication happens, and the slot's aren't used in the same way.

If I try code from before this PR then the problem is reproducible, and this PR does fix it. I've tried to test other instances of Slot/Fill, and haven't seen any side-effects so far.

Regardless of whether the block duplication shortcut causes a problem in master I think the fix is still important. Nice 👍

@aduth aduth force-pushed the update/handle-multi-mounted-slot branch from bdba6b8 to 7079dd0 Jan 22, 2019

@aduth aduth merged commit 527e25c into master Jan 22, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

@aduth aduth deleted the update/handle-multi-mounted-slot branch Jan 22, 2019

@youknowriad youknowriad added this to the 5.0 (Gutenberg) milestone Jan 22, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment