Skip to content

Conversation

@longfellowone
Copy link
Contributor

Summary

  • avoid binding this when invoking _disposeTableChangeListener to prevent Comlink cloning the adapter
  • add regression test for close() disposer context
  • add changeset for @powersync/web

Testing

  • pnpm test
  • pnpm --filter @powersync/web exec vitest --run tests/locked_adapter_close.test.ts

Fixes #805

@changeset-bot
Copy link

changeset-bot bot commented Jan 3, 2026

🦋 Changeset detected

Latest commit: c2fc51a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@powersync/web Patch
@powersync/diagnostics-app Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link
Collaborator

@stevensJourney stevensJourney left a comment

Choose a reason for hiding this comment

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

It's very strange that this issue wasn't detected in our other tests - or the manual multiple tabs testing we've recently been doing for testing other issues.
I can't think of a good reason for production builds being different from the development builds in this specific scenario.
That being said. The fact that this is being proxied is indeed an issue and the work here will prevent that.
The only nit I have is that we should probably add some comments for this behaviour in the code. I'll add that in a follow-up PR.
Thanks for the investigation, fix and contribution!

@stevensJourney stevensJourney merged commit d0c67b1 into powersync-ja:main Jan 3, 2026
3 checks passed
@longfellowone
Copy link
Contributor Author

Couldn't tell you why, only other info I can offer up is I have the service worker disabled in dev. To trigger it my code (worked every time) was roughly

disconnectAndClear()
close()
window.location.href

@longfellowone longfellowone deleted the fix-comlink-dispose-listener branch January 3, 2026 18:36
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.

DataCloneError in shared‑worker path (function sent over MessagePort)

2 participants