fix: handle options change and reconnects#330
Merged
threepointone merged 2 commits intocloudflare:mainfrom Feb 22, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: bf6c446 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Collaborator
|
I added a few more tests and guards, thanks for this pr. will land once ci passes. |
hono-party
partyfn
partyserver
partysocket
partysub
partysync
partytracks
partywhen
y-partyserver
commit: |
threepointone
approved these changes
Feb 22, 2026
Replace wrangler migration entries from `new_classes` to `new_sqlite_classes` across fixtures and READMEs and add a changeset documenting that partyserver now relies on SQLite-backed Durable Objects (synchronous storage). Update use-socket logic to track option changes while disabled, ensure correct socket creation/cleanup on re-enable and StrictMode/HMR, and always connect replacement sockets. Expand tests in partysocket to cover these re-enable, token-refresh, cleanup, and wire-level scenarios. Breaking: Durable Object namespaces must use `new_sqlite_classes` when deployed.
| @@ -0,0 +1,11 @@ | |||
| --- | |||
| "partyserver": minor | |||
Collaborator
There was a problem hiding this comment.
lemme see if I can workaround this
Contributor
Author
Thanks @threepointone! FWIW, the general |
e04b638 to
bf6c446
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We were running into a bug that'd cause a thundering herd style issue when using
agents. Basically, our chat interface allows you to switch between N conversations -- but we have an additional single use token query parameter used to authorize the websocket connection. When the websocket failed or we switch between different conversations (and thus, new connections) it used the stale token which made the reconnection fail and caused cascading useEffect related issues. We have applied this change as a patch in our project and things work as expected 🎉. The only real issue might be is if someone was relying on the faulty behavior that exists.If necessary, I can try to create an isolated reproduction with the same token exchange mechanics that we use.
A little follow up a few hours later: there is a race condition with
querywhen usinguseAgent-- if you pass a promise toquery, it'll try to resolve, but the websocket will try connect with stale options before react has a chance to update things, causing typicaluseEffect💣s .