Fix Yjs WebSocket in dev mode

- Add Vite plugin implementing y-protocols sync server for dev mode
- Fix useYjs hook: move provider creation into useEffect to survive
  React StrictMode remounts
- Fix WebSocket URL: use /sync as base (y-websocket appends room name)
- Verified in browser: Connected status, Host badge, awareness working

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ullrich Schäfer 2026-03-23 01:12:13 +01:00
parent 49e9d589b1
commit 230094b956
No known key found for this signature in database
GPG key ID: A32FF691A0F752D9
5 changed files with 151 additions and 21 deletions

View file

@ -21,10 +21,12 @@
"@trails-cool/ui": "workspace:*",
"drizzle-orm": "catalog:",
"isbot": "^5.1.0",
"lib0": "^0.2.117",
"react": "catalog:",
"react-dom": "catalog:",
"react-router": "catalog:",
"ws": "^8.20.0",
"y-protocols": "^1.0.7",
"y-websocket": "^3.0.0",
"yjs": "^13.6.30"
},