Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HMR in react when developing causes client disconnects #703

Open
stephenlacy opened this issue Jan 8, 2024 · 0 comments
Open

HMR in react when developing causes client disconnects #703

stephenlacy opened this issue Jan 8, 2024 · 0 comments

Comments

@stephenlacy
Copy link

This only appears in local dev. usePartySocket changes the clientId when I save a file that causes a HMR update.
(partysocket/react is only affected, server works fine)

Repro: https://github.com/stephenlacy/partykit-repro-2

pnpm i
pnpm dev

Open http://localhost:5173/
Save App.tsx, Page.tsx, etc
The socket.id changes on HMR.
I would expect the socket state to remain as other state values don't get affected by a HMR. I did a quick look into the hook and believe the ref/state memo is triggering a re-connect.

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

No branches or pull requests

1 participant