Skip to content

fix(DecryptedText): cancel in-flight animation on mouseleave in DecryptedText#933

Open
junijaei wants to merge 1 commit intoDavidHDev:mainfrom
junijaei:feature/fix-decrypted-text-mouseleave
Open

fix(DecryptedText): cancel in-flight animation on mouseleave in DecryptedText#933
junijaei wants to merge 1 commit intoDavidHDev:mainfrom
junijaei:feature/fix-decrypted-text-mouseleave

Conversation

@junijaei
Copy link
Copy Markdown

@junijaei junijaei commented Apr 1, 2026

Summary

Rapid hover on/off the DecryptedText component intermittently caused stale setInterval callbacks to keep firing after mouseleave, resulting in overlapping animations and broken reset behavior.

Root Cause

The interval ID was stored in a local variable inside the useEffect, so triggerHoverDecrypt and resetToPlainText had no reference to it and could not cancel it on hover exit.

Fix

  • Moved the interval ID into an intervalRef so it is accessible outside the effect.
  • resetToPlainText now cancels the active interval before clearing state.

Changes

All 4 component variants updated

  • src/content/TextAnimations/DecryptedText/DecryptedText.jsx
  • src/tailwind/TextAnimations/DecryptedText/DecryptedText.jsx
  • src/ts-default/TextAnimations/DecryptedText/DecryptedText.tsx
  • src/ts-tailwind/TextAnimations/DecryptedText/DecryptedText.tsx

Registry artifacts regenerated

  • public/r/DecryptedText-JS-CSS.json
  • public/r/DecryptedText-JS-TW.json
  • public/r/DecryptedText-TS-CSS.json
  • public/r/DecryptedText-TS-TW.json

Before

hover-bug_decrypted-text

After

hover-bug_decrypted-text_fixed

Testing

  • Tested locally — rapid hover on/off no longer causes overlapping or stuck animations
  • No browser console errors
  • All 4 variants updated

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.

1 participant