Commit 8300088 1 parent caa33a8 commit 8300088 Copy full SHA for 8300088
File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @use-funnel/core ' : patch
3
+ ' @use-funnel/browser ' : patch
4
+ ' @use-funnel/next ' : patch
5
+ ' @use-funnel/react-navigation-native ' : patch
6
+ ' @use-funnel/react-router-dom ' : patch
7
+ ---
8
+
9
+ fix(core): add state initial fallback when history array is empty
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ export function createUseFunnel<TRouteOption extends RouteOption>(
57
57
id : options . id ,
58
58
initialState : options . initial ,
59
59
} ) ;
60
- const currentState = router . history [ router . currentIndex ] as FunnelStateByContextMap < TStepContextMap > ;
60
+ const currentState = ( router . history [ router . currentIndex ] ?? options . initial ) as FunnelStateByContextMap < TStepContextMap > ;
61
61
const currentStateRef = useUpdatableRef ( currentState ) ;
62
62
63
63
const parseStepContext = useCallback (
You can’t perform that action at this time.
0 commit comments