feat: add memory router mode#2660
Merged
Merged
Conversation
Add a third `routerMode` value, `memory`, backed by vue-router's createMemoryHistory. Routing is kept in memory so the URL never reflects the slide number and cannot be used to navigate — useful for kiosk or externally driven "follower" decks. Export and the PNG build path fall back to history routing since they navigate by URL.
✅ Deploy Preview for slidev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@slidev/client
create-slidev
create-slidev-theme
@slidev/parser
@slidev/cli
@slidev/types
commit: |
antfu
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a third
routerModevalue —memory— backed by vue-router'screateMemoryHistory. Routing is kept entirely in memory, so:/1,/2, … as the deck advances), and/12is ignored (the deck boots at slide 1).Existing
history(default) andhashbehaviour is unchanged.Why
For kiosk / public "follower" decks — a deck shown on a shared screen or handed out as a public URL that's driven externally (e.g. via a sync addon). Keeping the slide number out of the URL stops viewers from reading their position or jumping ahead by editing the URL. This is URL hygiene, not navigation locking — arrow/click navigation still works; disabling that belongs to the follower layer, not core.
As a bonus it sidesteps the history-mode refresh-404 problem on plain static hosts (there's no path left to 404 on).
Behaviour / limitations
Because memory mode has no URL routing, deep-links,
/presenter,/overview, and export-by-URL aren't reachable in this mode. Export and the PNG/PDF build path therefore fall back tohistoryrouting (they navigate by URL). These are documented in therouterModeJSDoc.Changes
routerModetype accepts'memory'(frontmatter config + build-time override)createMemoryHistoryvia a new__SLIDEV_MEMORY_ROUTE__build flag (gated off during export)--router-modeCLI flag acceptsmemorymemory→historyVerified
pnpm build,pnpm typecheck,pnpm lint, andpnpm testpass. Manually verified in both dev and build: advancing the deck leaves the URL untouched, and a typed/Nboots at slide 1.