Skip to content

Clear the active question on Slidev 51 too - #6

Merged
irinanazarova merged 1 commit into
mainfrom
slidev-51-slide-numbers
Oct 7, 2026
Merged

irinanazarova merged 1 commit into
mainfrom
slidev-51-slide-numbers

Conversation

@irinanazarova

@irinanazarova irinanazarova commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

What

The addon declares support for Slidev >= 0.50, but 0.5.0 reads the slide number from the onSlideEnter/onSlideLeave callback arguments. Slidev 52 passes (to, from); Slidev 0.50 and 51 call the hooks with no arguments. On those versions the leave hook's from is always undefined, so the question is never cleared and phones keep showing it after the presenter leaves the slide.

  • Both layouts now call a new useActiveQuestion() composable in useQuizManager.ts. It takes the slide's own number from useSlideContext().$page, which every supported version provides, and holds the activate-on-mount, activate-on-enter and "clear only if this slide set it" rules in one place. setActive and clearActive had no other callers and are gone.
  • A quiz slide with missing fields registers no question, so it no longer activates one on enter either.
  • The debug skill names the "phones keep showing the question" symptom and the fix.

How to verify

  • npm test and tsc pass.
  • Playwright on a six-slide deck (cover, quiz, results, plain slide, quiz with missing fields, end), stepping forward and back and reading activeQuestionId from each sync:
    • main on Slidev 51.8.2 reproduces the bug: the question is never cleared, and the slide with missing fields activates its question.
    • This branch on Slidev 51.8.2 and 52: the question is active on the quiz and results slides only, and null everywhere else, in both directions.
  • A Slidev 51 deck (evilmartians/all-hands) with 0.5.0 fails its local end-to-end quiz test; with these layouts, that test and the rest of its suite pass.

Checklist

  • npm test passes
  • New behavior has a test, or a note on why it cannot be unit-tested: adapter-only change, the addon has no component test harness; verified in a browser on Slidev 51 and 52
  • No boundary payload changes
  • README unchanged: no API or setup change
  • CHANGELOG.md has an entry under "Unreleased"

0.5.0 took the slide number from the onSlideEnter/onSlideLeave arguments.
Slidev 52 passes (to, from); 0.50 and 51 call the hooks with none, so the
leave hook's from was always undefined and the question was never cleared:
phones kept showing it after the presenter moved on.

Both layouts now call useActiveQuestion(), which uses the slide's own
number from useSlideContext().$page and holds the activation rules in one
place. A quiz slide with missing fields registers no question, so it no
longer activates one on enter either.

The debug skill names the symptom and the fix.
@irinanazarova
irinanazarova force-pushed the slidev-51-slide-numbers branch from f9db0a9 to d14fdb4 Compare October 7, 2026 11:49
@irinanazarova
irinanazarova merged commit 162b74b into main Oct 7, 2026
2 checks passed
@irinanazarova
irinanazarova deleted the slidev-51-slide-numbers branch October 7, 2026 12:20
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