From 0b98913f1cc51c2321c6e2f56f3dbc50e00eb157 Mon Sep 17 00:00:00 2001 From: Fabian Ehrentraud Date: Wed, 14 May 2025 17:44:21 +0200 Subject: [PATCH] fix callback not called when skipping on first step --- src/modules/useJoyrideData.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/useJoyrideData.ts b/src/modules/useJoyrideData.ts index a07f070e8..fcd968e03 100644 --- a/src/modules/useJoyrideData.ts +++ b/src/modules/useJoyrideData.ts @@ -346,12 +346,12 @@ export default function useJoyrideData( }); } - if (previousStep && changedState('status', [STATUS.FINISHED, STATUS.SKIPPED])) { + if (changedState('status', [STATUS.FINISHED, STATUS.SKIPPED])) { callback?.({ ...state, - index: index - 1, + index: previousStep ? index - 1 : 0, // Return the last step when the tour is finished - step: previousStep, + step: previousStep ?? step, type: EVENTS.TOUR_END, }); store.current.reset();