Skip to content

fix: don't surface an uncaught AbortError on StrictMode cleanup - #20

Closed
dkdndes wants to merge 1 commit into
GoogleChromeLabs:mainfrom
alpininsight:fix/strictmode-abort-error
Closed

dkdndes wants to merge 1 commit into
GoogleChromeLabs:mainfrom
alpininsight:fix/strictmode-abort-error

Conversation

@dkdndes

@dkdndes dkdndes commented Nov 16, 2026

Copy link
Copy Markdown

Fixes #19

React StrictMode runs the registration effect's cleanup on the first mount, which aborts the registerTool signal. Calling controller.abort() with no argument creates a default AbortError ("signal is aborted without reason"), and that can show up as an uncaught rejection even though the hook already ignores aborted registrations in its own state.

This passes a cleanup reason to abort() so the default AbortError is never created, and adds a StrictMode test that fails if an uncaught AbortError leaks.

npm test: 37 passing.

abort() without a reason creates a default AbortError, which can
show up as an uncaught rejection when React StrictMode remounts
and runs the registration cleanup. Pass a cleanup reason and
cover the remount with a test.
@beaufortfrancois

Copy link
Copy Markdown
Collaborator

#19 (comment)

@dkdndes

dkdndes commented Nov 20, 2026

Copy link
Copy Markdown
Author

Thanks for looking into this, @beaufortfrancois, and sorry for the noise. I missed that #16 already covered this. I was testing against the published 0.3.0 from npm, which doesn't include #16 yet, so in Chrome I could still see the uncaught AbortError and couldn't verify the fix on main.

For next time: is installing straight from the repo (npm install github:GoogleChromeLabs/use-webmcp-tool) the recommended way to try unreleased fixes, or is there a preview build somewhere? I'll check against the new release once it's out and report back if anything still shows up.

@beaufortfrancois

Copy link
Copy Markdown
Collaborator

No worries at all!

Yes, installing from GitHub is the way to go for now. There are no preview builds as the package has no build step.

npm install github:GoogleChromeLabs/use-webmcp-tool
# or pin a specific commit:
npm install github:GoogleChromeLabs/use-webmcp-tool#<commit-sha>

We'll cut a new release that includes #16 soon™️

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.

AbortError: signal is aborted without reason

2 participants