Skip to content

fix(usePresence): handle canceled exit animations - #24056

Open
rileydanejohnston wants to merge 3 commits into
carbon-design-system:mainfrom
rileydanejohnston:fix/23659-presence-abort-error
Open

rileydanejohnston wants to merge 3 commits into
carbon-design-system:mainfrom
rileydanejohnston:fix/23659-presence-abort-error

Conversation

@rileydanejohnston

@rileydanejohnston rileydanejohnston commented Nov 14, 2026 •

Copy link
Copy Markdown

Closes #23659

Animation.finished rejects with an AbortError when an exit animation is canceled, for example when a component unmounts during its exit animation. usePresence and useSidePanelPresence chained .finally() with no rejection handler, so the rejection surfaced as an unhandled promise rejection. Both hooks now handle it, and the exit still finishes the same way. Picks up from #23670, which was closed in a draft cleanup.

Changelog

New

  • Tests for useSidePanelPresence, including the canceled-animation case

Changed

  • usePresence and useSidePanelPresence handle the AbortError from a canceled exit animation instead of leaving it unhandled
  • usePresence tests cover a canceled exit animation

Testing / Reviewing

  • Run yarn test packages/react/src/internal/__tests__/usePresence-test.js packages/react/src/internal/__tests__/useSidePanelPresence-test.js
  • The two new canceled-animation tests fail on main with AbortError: The animation was aborted. (unhandled rejection) and pass with this change

PR Checklist

As the author of this PR, before marking ready for review, confirm you:

  • Reviewed every line of the diff
  • Updated documentation and storybook examples (internal hooks, no API change)
  • Followed the required v12 migration documentation for any code change that affects v12, or struck through this item because the PR does not affect v12
  • Wrote passing tests that cover this change
  • Addressed any impact on accessibility (a11y) (no a11y impact)
  • Tested for cross-browser consistency (promise handling only, no rendering change)
  • Validated that this code is ready for review and status checks should pass

More details can be found in the pull request guide.

@netlify

netlify Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for v12-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 78f96f4
🔍 Latest deploy log https://app.netlify.com/projects/v12-carbon-react/deploys/6afb46dd79ed3f08f371ca41
😎 Deploy Preview https://deploy-preview-24056--v12-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for v12-carbon-web-components ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 78f96f4
🔍 Latest deploy log https://app.netlify.com/projects/v12-carbon-web-components/deploys/6afb46ddefa4c71c5df786fb
😎 Deploy Preview https://deploy-preview-24056--v12-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the DCO.
Posted by the DCO Assistant Lite bot.

@netlify

netlify Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 78f96f4
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/6afb46dd15013cfa8c17bfdd
😎 Deploy Preview https://deploy-preview-24056--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 78f96f4
🔍 Latest deploy log https://app.netlify.com/projects/carbon-elements/deploys/6afb46dd50d91a90017722dc
😎 Deploy Preview https://deploy-preview-24056--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@rileydanejohnston
rileydanejohnston marked this pull request as ready for review November 14, 2026 02:16
@rileydanejohnston
rileydanejohnston requested a review from a team as a code owner November 14, 2026 02:16
@rileydanejohnston

Copy link
Copy Markdown
Author

I have read the DCO document and I hereby sign the DCO.

@carbon-monitor-agent

Copy link
Copy Markdown
Collaborator

[AI agent review — Carbon grounded] · Looks Good · Reviewed by: IBM Bob · Commit: 53a5ba4

This PR adds a rejection handler to the exit-animation promise chains in usePresence and useSidePanelPresence, so a canceled animation no longer causes an unhandled AbortError. It also adds tests for the canceled-animation case.

@netlify

netlify Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for v11-carbon-web-components ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 78f96f4
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/6afb46dd00777cbd11aea693
😎 Deploy Preview https://deploy-preview-24056--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: usePresence leaves an unhandled AbortError when a component unmounts during its exit animation

2 participants