Skip to content

fix(deck): scope poll activation + QR overlay to the right Slidev view#48

Merged
asm0dey merged 2 commits into
mainfrom
fix/presenter-mode-qr-and-activation
Jun 5, 2026
Merged

fix(deck): scope poll activation + QR overlay to the right Slidev view#48
asm0dey merged 2 commits into
mainfrom
fix/presenter-mode-qr-and-activation

Conversation

@asm0dey

@asm0dey asm0dey commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Two presenter-mode bugs, both from deck components being unaware of which Slidev view renders them.

Active question goes stale in presenter mode

Slidev mounts the next-slide preview (previewNext) and overview as live component copies. PollPanel ignored $renderContext, so the preview copy of the next question reclaimed activation on every SSE snapshot, fighting the on-screen panel — the active question flapped and looked stuck until a manual refresh.

  • Gate every activate/close POST on $renderContext (slide/presenter only); previewNext/overview render read-only.

QR opens only in the presenter window

The overlay was component-local, so toggling it in the presenter never reached the audience window.

  • useQrBroadcast syncs overlay visibility across same-origin windows via BroadcastChannel (the primitive Slidev's own state sync falls back to without a server).
  • Free toggle kept; overlay decoupled from the sign-in gate so the audience window renders it; channel keyed per question so only the on-screen panel reacts.

Tests

  • Unit coverage for the render-context gate and the QR sync.
  • Presenter-mode e2e covering both — the previously-untested presenter/audience interaction.

asm0dey added 2 commits June 5, 2026 00:09
Presenter mode renders the next-slide preview (previewNext) and the
overview as live component copies. PollPanel ignored $renderContext, so
the preview copy of the *next* question reclaimed activation on every SSE
snapshot, fighting the on-screen panel — the active question flapped and
appeared stuck until a manual refresh. Gate every activate/close POST on
the render context (slide/presenter only); preview/overview render
read-only.

QR overlay was component-local, so toggling it in the presenter window
never reached the audience window. Sync visibility across same-origin
windows via a BroadcastChannel (useQrBroadcast) — the primitive Slidev's
own state sync falls back to without a server. The free toggle is kept;
the overlay is decoupled from the sign-in gate so the audience window
renders it, and the channel is keyed per question so only the on-screen
panel reacts.

Adds unit coverage for the gate and the QR sync, plus presenter-mode e2e
covering both (the previously-untested presenter/audience interaction).
slidev-results-cross-origin and slidev-question-switch both drive the
same Slidev dev server and the same checked-in slidev-demo/data.ts (each
beforeAll rewrites it with its own seeded slug/pollId), and deck sign-in
mints a token for the user's most-recently-created poll. Run in parallel
they raced: one spec's data.ts write and deck token bled into the other,
producing the wrong slug in the QR overlay and intermittent 403
(token poll mismatch) on activate.

Move the question-switch spec into its own project that depends on
slidev-chromium so the two never overlap, while the voter specs keep
parallelizing. Validated by running the full suite 3x at 6 workers with
zero flakes.
@sonarqubecloud

sonarqubecloud Bot commented Jun 4, 2026

Copy link
Copy Markdown

@asm0dey asm0dey merged commit 3269645 into main Jun 5, 2026
9 checks passed
@asm0dey asm0dey deleted the fix/presenter-mode-qr-and-activation branch June 5, 2026 06:39
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