Skip to content

Playground: drop a save poll once its editor page is gone, so Save does not wait on it - #1955

Merged
nedtwigg merged 1 commit into
mainfrom
fix/issue-1953
Nov 30, 2026
Merged

nedtwigg merged 1 commit into
mainfrom
fix/issue-1953

Conversation

@dormouse-bot

Copy link
Copy Markdown
Collaborator

In the website playground, a save poll from an editor page that was reloaded or closed stayed in editorPages' waiting set for up to 20 s, because the relayed request carried no closed signal. The host's next Save asked that dead waiter, nothing answered, and the round failed after 10 s with "The editor did not finish saving in time."

The relay now carries the page's departure through:

  • Service worker (website/public/playground-fs/sw.js): while a save-poll is held, it posts playground-fs-closed on the request's channels when the request's signal aborts, or when clients.get(clientId) no longer finds the page (checked each second, for browsers whose request signal does not abort).
  • Window (sw-relay.ts respond): that message aborts an AbortController whose signal becomes the request's closed, which editorRoutes already hands to pages.poll. The dropped poll answers empty and leaves the waiting set.

A new test in playground-fs.test.ts relays a save-poll, posts the closed message, and expects the poll to answer {} and the next hostRequest to fail within the 1 s grace with "The editor is not connected." Before the change it timed out with the poll still held. The worker side has no automated test and has not been run in a browser. In particular, whether clients.get stops finding a reloaded frame's client within the check interval is unconfirmed. docs/specs/tutorial.md states the new worker rule, and its word budget is ratcheted to fit.

A save asked within the same second the page goes away can still reach the dead poll before the check notices, where the request signal does not abort. The Pocket frame tunnel question in the issue is untouched.

Closes #1953 — automated triage

The playground's service worker now posts playground-fs-closed on a held
save poll's channels when its page's request aborts or its client is gone,
and the window aborts the poll's closed signal, so the host's next Save is
not handed to a page that will never answer.

Closes #1953
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 125137d
Status: ✅  Deploy successful!
Preview URL: https://a353e6a9.mouseterm.pages.dev
Branch Preview URL: https://fix-issue-1953.mouseterm.pages.dev

View logs

@nedtwigg
nedtwigg merged commit 549b54a into main Nov 30, 2026
13 checks passed
@nedtwigg
nedtwigg deleted the fix/issue-1953 branch November 30, 2026 23:42
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.

Playground: Save waits on a long poll from an editor page that already went away, then fails after 10 s

2 participants