@@ -96,6 +96,7 @@ export function navigate<T>(options: NavigationOptions<T>): SvelteComponent<T> {
96
96
export interface BackNavigationOptions {
97
97
frame ?: FrameSpec ;
98
98
to ?: PageElement ;
99
+ backStackEntry ?: BackstackEntry ;
99
100
100
101
// only in Akylas fork for now
101
102
transition ?: NavigationTransition ;
@@ -108,17 +109,19 @@ export function goBack(options: BackNavigationOptions = {}) {
108
109
if ( ! targetFrame ) {
109
110
throw new Error ( "goback requires frame option to be a native Frame, a FrameElement, a frame Id, or null" )
110
111
}
111
- let backStackEntry : BackstackEntry = null ;
112
- if ( options . to ) {
113
- backStackEntry = targetFrame . backStack . find ( e => e . resolvedPage === options . to . nativeView ) ;
114
- if ( ! backStackEntry ) {
115
- throw new Error ( "Couldn't find the destination page in the frames backstack" )
112
+ let backStackEntry : BackstackEntry = options . backStackEntry ;
113
+ if ( ! backStackEntry ) {
114
+ if ( options . to ) {
115
+ backStackEntry = targetFrame . backStack . find ( e => e . resolvedPage === options . to . nativeView ) ;
116
+ if ( ! backStackEntry ) {
117
+ throw new Error ( "Couldn't find the destination page in the frames backstack" )
118
+ }
119
+ delete options . to ;
120
+ Object . assign ( backStackEntry , options )
121
+ } else {
122
+ backStackEntry = targetFrame . backStack [ targetFrame . backStack . length - 1 ] ;
123
+ Object . assign ( backStackEntry , options )
116
124
}
117
- delete options . to ;
118
- Object . assign ( backStackEntry , options )
119
- } else {
120
- backStackEntry = targetFrame . backStack [ targetFrame . backStack . length - 1 ] ;
121
- Object . assign ( backStackEntry , options )
122
125
}
123
126
return targetFrame . goBack ( backStackEntry ) ;
124
127
}
0 commit comments