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

fix: Disable snippet previews while snippet panel is closing #371

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

felixhabib
Copy link
Contributor

Resolves #368

This issue occurs when the user moves their cursor over a snippet in the snippet panel, while the panel is closing.
This triggers the frames to enter a mode for previewing snippets, which is only ended when the snippets panel is initially closed.

This change prevents snippets from being previewed after the panel begins to close.

@felixhabib felixhabib requested a review from a team as a code owner October 10, 2024 04:05
Copy link

changeset-bot bot commented Oct 10, 2024

🦋 Changeset detected

Latest commit: 14d14e0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
playroom Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@michaeltaranto michaeltaranto left a comment

Choose a reason for hiding this comment

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

Nice one!

@felixhabib felixhabib merged commit c5d5808 into master Oct 10, 2024
6 checks passed
@felixhabib felixhabib deleted the fix-snippet-preview-bug branch October 10, 2024 04:16
Comment on lines +5 to +8
Disable snippet previews while the snippets panel is closing.

Previously, snippet previews could be triggered while the snippet panel was closing, causing preview frames to enter an invalid state.
Previewing a snippet will now only work when the snippet panel is open.
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels a bit too much like implementation detail to me. I'd just mention the bug and say it's fixed.

Suggested change
Disable snippet previews while the snippets panel is closing.
Previously, snippet previews could be triggered while the snippet panel was closing, causing preview frames to enter an invalid state.
Previewing a snippet will now only work when the snippet panel is open.
Fixes a bug that was causing duplicate snippet previews and broken preview updates when a snippet was clicked and the mouse was moved while the snippets panel was closing

It's a bit of a long sentence, but I think it gets the point across.

Comment on lines +146 to +154
isOpen && !isHighlighted
? () => {
setHighlightedIndex(index);
}
: undefined
}
onMouseDown={() => closeHandler(filteredSnippets[index])}
onMouseDown={() => {
closeHandler(filteredSnippets[index]);
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could make this diff smaller by removing the curly braces from the functions. Github wouldn't let me suggest a change :(

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.

Duplicated components in viewport but not in code panel 😣
3 participants