Skip to content

Close detach() properly; stop re-running startup code on every disconnect - #1

Merged
lanrat merged 1 commit into
mainfrom
claude/zealous-dhawan-588e8e
Oct 17, 2026
Merged

lanrat merged 1 commit into
mainfrom
claude/zealous-dhawan-588e8e

Conversation

@lanrat

@lanrat lanrat commented Oct 17, 2026

Copy link
Copy Markdown
Owner

detach() in web/js/main.js was missing its closing brace, so it contained a duplicate copy of the top-level startup code. Every disconnect re-registered the erase, full-screen, fullscreenchange and resize listeners, re-ran the service-worker cleanup and finalizeInterrupted(), and re-read settings. The duplicate first appeared in 82be485 and grew with each later commit.

  • Removed the nested copy (diffed against the real top-level code: identical).
  • Kept detach()'s own body, including the updateWakeLock() call it had from the start.

Testing

  • node --check js/main.js passes
  • npm test: 54 pass, 0 fail, 4 skipped
  • Preview: simulator connect → disconnect → reconnect → disconnect works; zero listeners added on disconnect
  • Full screen: the preview pane blocks the real Fullscreen API, so enter/exit was checked by simulating the fullscreen state. Exit button and Disconnect each call exitFullscreen once. Still worth a tap on a real phone.

…nect

detach() was missing its closing brace, so it swallowed a duplicate copy
of the top-level startup code. Every disconnect re-registered the erase,
full-screen, fullscreenchange and resize listeners, re-ran the
service-worker cleanup and finalizeInterrupted(), and re-read settings.
The duplicate first appeared in 82be485 and grew with each later commit.

Remove the nested copy (identical to the real top-level code) and keep
detach()'s own body, including the updateWakeLock() call it had before.
@lanrat
lanrat merged commit 33d69fc into main Oct 17, 2026
2 checks passed
@lanrat
lanrat deleted the claude/zealous-dhawan-588e8e branch October 17, 2026 23:45
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.

1 participant