Skip to content

fix(animated-theme-toggler): prevent compositor crashes and glitches on rapid click#987

Merged
Yeom-JinHo merged 5 commits into
magicuidesign:mainfrom
itskdhere:fix-animated-theme-toggler-crash
Jul 19, 2026
Merged

fix(animated-theme-toggler): prevent compositor crashes and glitches on rapid click#987
Yeom-JinHo merged 5 commits into
magicuidesign:mainfrom
itskdhere:fix-animated-theme-toggler-crash

Conversation

@itskdhere

Copy link
Copy Markdown
Contributor

Description

This PR introduces concurrency locks, a toggle cooldown, and temporary user-interaction disabling (inert) to the AnimatedThemeToggler component. These measures ensure that multiple View Transitions cannot overlap or run simultaneously, preventing browser-level crashes and rendering glitches.

Changes

  • Added isTransitioningRef and isTransitioning state to block initiating a new transition if one is already active.
  • Introduced a 500ms strict debounce threshold (lastToggleTimeRef) between toggles to prevent spamming the compositor.
  • Set the document root to inert and added a pointer-events: none !important style to all ::view-transition pseudo-elements during execution.
  • Wrapped transition promises with proper .catch() and cleanup states to prevent the layout from locking up if a transition is aborted or fails.

Motivation

Fixes #986

Breaking Changes

None.

Screenshots Demo

Device / Browser / Viewport: Windows / Chrome / Desktop

Before After
https://magicui-animated-theme-toggler.vercel.app/crash https://magicui-animated-theme-toggler.vercel.app/fix

@vercel

vercel Bot commented Jul 17, 2026

Copy link
Copy Markdown

@itskdhere is attempting to deploy a commit to the product-studio Team on Vercel.

A member of the Team first needs to authorize it.

@Yeom-JinHo
Yeom-JinHo self-requested a review July 18, 2026 15:33

@Yeom-JinHo Yeom-JinHo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @itskdhere — pushed follow-ups that trim the fix down to just the in-flight transition lock, since overlapping transitions are what crash the compositor

@Yeom-JinHo
Yeom-JinHo merged commit 7f1aea7 into magicuidesign:main Jul 19, 2026
5 of 6 checks passed
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.

[bug]: Animated Theme Toggler crash on Chromium based browsers

2 participants