Skip to content

Fix permalink join race on reconnect and room-not-found UX#218

Merged
aaylward merged 1 commit into
mainfrom
fix-golf-p2-permalink-race-and-error
Apr 12, 2026
Merged

Fix permalink join race on reconnect and room-not-found UX#218
aaylward merged 1 commit into
mainfrom
fix-golf-p2-permalink-race-and-error

Conversation

@aaylward
Copy link
Copy Markdown
Contributor

@aaylward aaylward commented Apr 12, 2026

Permalink joins were racing with reconnection state restore — isConnected flips true before the server sends back roomJoined, so the permalink effect would fire a joinRoom into the gap. Added an isReconnecting flag that blocks the effect until restore completes (or a 2s safety timeout).

Also, when a permalink points to a room that no longer exists, the server error was getting swallowed as a generic notification and the user had to wait 10s for the timeout. Now server errors cancel the pending join immediately and show a "room no longer exists" message with a create-room button.

Closes #213, closes #214

Add isReconnecting state to suppress permalink join attempts while
the server is restoring session state after a reconnect. The flag is
set when the authenticated message has reconnected=true and cleared
when onRoomJoined fires (with a 2s safety timeout).

Add onGameError callback through the plugin/adapter/hook chain so
server error messages (e.g. "Room not found") immediately cancel
a pending permalink join and show a clear error with a Create New
Room button, instead of waiting for the 10s timeout.

Closes #213, closes #214
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
muchq b37ecd5 Commit Preview URL

Branch Preview URL
Apr 12 2026, 06:47 PM

@aaylward aaylward enabled auto-merge (squash) April 12, 2026 18:50
@aaylward aaylward merged commit 626f20e into main Apr 12, 2026
2 checks passed
@aaylward aaylward deleted the fix-golf-p2-permalink-race-and-error branch April 12, 2026 18:51
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.

Golf: silent failure when room no longer exists after grace period Golf: permalink join races with reconnection state restore

1 participant