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

Components: Handle multiple Slots by same name #12882

Merged
merged 1 commit into from
Jan 22, 2019

Conversation

aduth
Copy link
Member

@aduth 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 added [Type] Bug An existing feature does not function as intended [Feature] UI Components Impacts or related to the UI component system labels Dec 14, 2018
@aduth aduth force-pushed the update/handle-multi-mounted-slot branch from 6294dda to bdba6b8 Compare January 3, 2019 15:42
Copy link
Contributor

@johngodley johngodley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] UI Components Impacts or related to the UI component system [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicating a custom HTML block can show two block toolbars
3 participants