Skip to content

fix: make useIsSlideActive() based on useSlideContext().$nav.currentSlideNo instead of useNav().currentSlideNo#2311

Merged
antfu merged 2 commits into
slidevjs:mainfrom
whitphx:use-is-slide-active-based-on-nav-context
Oct 22, 2025
Merged

fix: make useIsSlideActive() based on useSlideContext().$nav.currentSlideNo instead of useNav().currentSlideNo#2311
antfu merged 2 commits into
slidevjs:mainfrom
whitphx:use-is-slide-active-based-on-nav-context

Conversation

@whitphx

@whitphx whitphx commented Oct 21, 2025

Copy link
Copy Markdown
Contributor

Because useNav().currentSlideNo is just a value parsed from the URL route but useSlideContext().$nav.currentSlideNo is a more controlled value that even works in print/export mode.

Fixes #2310

Let me create this PR before the discussion in #2310 is settled just for dumping and proposing my current idea. Plz decline it if it's not appropriate.

…lideNo instead of useNav().currentSlideNo

Because useNav().currentSlideNo is just a value parsed from the URL route
but useSlideContext().$nav.currentSlideNo is a more controlled value that even works in print/export mode.
@netlify

netlify Bot commented Oct 21, 2025

Copy link
Copy Markdown

Deploy Preview for slidev ready!

Name Link
🔨 Latest commit 04226f6
🔍 Latest deploy log https://app.netlify.com/projects/slidev/deploys/68f86910f58396000835868c
😎 Deploy Preview https://deploy-preview-2311--slidev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Oct 21, 2025

Copy link
Copy Markdown

Open in StackBlitz

@slidev/client

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/client@2311

create-slidev

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev@2311

create-slidev-theme

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev-theme@2311

@slidev/parser

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/parser@2311

@slidev/cli

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/cli@2311

@slidev/types

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/types@2311

commit: 04226f6

@antfu antfu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@whitphx
whitphx marked this pull request as ready for review October 22, 2025 05:18
@antfu
antfu merged commit 05a0646 into slidevjs:main Oct 22, 2025
20 checks passed
@whitphx
whitphx deleted the use-is-slide-active-based-on-nav-context branch October 22, 2025 06:28
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.

In print/export mode, useIsSlideActive() is true only in the first slide and false in all other slides

2 participants