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

CC-959: Hide instead of destroy Tippy instance on disconnect #2546

Merged
merged 1 commit into from Sep 27, 2022

Conversation

danielamorse
Copy link
Collaborator

Jira

Summary

Fixes a rare bug where a Popover/Tooltip inside of a Bolt List (or any other web component) fails to open.

Details

When a Popover/Tooltip is inside another Bolt web component, and that other web component renders after the Popover/Tooltip has rendered, it will trigger the Popover/Tooltip to disconnect. We are currently destroying the Tippy instance on disconnect. When the Popover/Tooltip reconnects, I expected it would reinitialize the Tippy instance, but it does not because the component's firstUpdated() lifecycle event only fires on the initial creation.

Instead of destroying the Tippy instance I am now just hiding it, which solves the original problem we sought to fix in #2513, without creating this other bug.

How to test

  • Review code
  • Open test page in PL: /pattern-lab/?p=tests-popover-disconnected-callback
  • Replace the main Bolt List component JS file (packages/components/bolt-list/index.js) with this:
import { lazyQueue } from '@bolt/lazy-queue';

lazyQueue(['bolt-list'], async () => {
  // This forces the race condition to happen every time (for testing only!)
  setTimeout(async () => {
    await import(/*  webpackChunkName: 'bolt-list' */ './main');
  }, 100);
});
  • Verify the Popover/Tooltip still works on the test page.

@github-actions github-actions bot added the type: feature List this PR in the 'Features' section of the release notes. label Sep 26, 2022
Copy link
Collaborator

@adamszalapski adamszalapski left a comment

Choose a reason for hiding this comment

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

I can confirm, working as designed.

@danielamorse danielamorse merged commit 3608e44 into master Sep 27, 2022
@danielamorse danielamorse deleted the feature/CC-959-popover-disconnect-bug branch September 27, 2022 13:43
danielamorse added a commit that referenced this pull request Sep 27, 2022
…-disconnect-bug

CC-959: Hide instead of destroy Tippy instance on disconnect
@danielamorse danielamorse mentioned this pull request Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature List this PR in the 'Features' section of the release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants