Skip to content

fix: cancel requestAnimationFrame on unmount in ContentOverlayController#217

Open
eunwoo-levi wants to merge 2 commits intotoss:mainfrom
eunwoo-levi:fix/cancel-raf-on-unmount
Open

fix: cancel requestAnimationFrame on unmount in ContentOverlayController#217
eunwoo-levi wants to merge 2 commits intotoss:mainfrom
eunwoo-levi:fix/cancel-raf-on-unmount

Conversation

@eunwoo-levi
Copy link
Copy Markdown

Description

  • The useEffect in ContentOverlayController schedules a requestAnimationFrame but does not cancel it in the cleanup function. If the component unmounts before the next frame fires (e.g. rapidly opening and closing an overlay), the callback still executes and dispatches a stale OPEN action.

Changes

  • Added cancelAnimationFrame cleanup in the useEffect of ContentOverlayController to cancel the pending frame on unmount.

Motivation and Context

How Has This Been Tested?

  • Verified existing unit tests pass locally.
  • Manually confirmed that rapid open/close sequences no longer produce stale dispatches.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have performed a self-review of my own code.
  • My code is commented, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.

Further Comments

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 11, 2026

⚠️ No Changeset found

Latest commit: dfa6a1d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 11, 2026

@eunwoo-levi is attempting to deploy a commit to the Toss Team on Vercel.

A member of the Team first needs to authorize it.

@eunwoo-levi eunwoo-levi force-pushed the fix/cancel-raf-on-unmount branch from 68fc89f to a8c1256 Compare February 11, 2026 19:00
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