@@ -3,7 +3,8 @@ import type { ComputedRef, Ref, TransitionGroupProps } from 'vue'
33import { computed , ref , watch } from 'vue'
44import type { Router } from 'vue-router'
55import { getCurrentTransition } from '../logic/transition'
6- import { getSlidePath } from '../logic/slides'
6+ import { getSlide , getSlidePath } from '../logic/slides'
7+ import { CLICKS_MAX } from '../constants'
78import { useTocTree } from './useTocTree'
89import { skipTransition } from './hmr'
910import { slides } from '#slidev/slides'
@@ -121,12 +122,12 @@ export function useNavBase(
121122 async function prevSlide ( lastClicks = true ) {
122123 clicksDirection . value = - 1
123124 const next = Math . max ( 1 , currentSlideNo . value - 1 )
124- await go ( next )
125- if ( lastClicks && clicksTotal . value ) {
126- router ?. replace ( {
127- query : { ... router . currentRoute . value . query , clicks : clicksTotal . value } ,
128- } )
129- }
125+ await go (
126+ next ,
127+ lastClicks
128+ ? getSlide ( next ) ?. meta . __clicksContext ?. total ?? CLICKS_MAX
129+ : undefined ,
130+ )
130131 }
131132
132133 function goFirst ( ) {
@@ -141,7 +142,10 @@ export function useNavBase(
141142 skipTransition . value = false
142143 await router ?. push ( {
143144 path : getSlidePath ( page ) ,
144- query : { ...router . currentRoute . value . query , clicks } ,
145+ query : {
146+ ...router . currentRoute . value . query ,
147+ clicks : clicks || undefined ,
148+ } ,
145149 } )
146150 }
147151
0 commit comments