@@ -122,31 +122,35 @@ export async function render<SutType, WrapperType = SutType>(
122
122
123
123
const router = inject ( Router ) ;
124
124
if ( typeof router ?. initialNavigation === 'function' ) {
125
- router ?. initialNavigation ( ) ;
125
+ if ( zone ) {
126
+ zone . run ( ( ) => router ?. initialNavigation ( ) ) ;
127
+ } else {
128
+ router ?. initialNavigation ( ) ;
129
+ }
126
130
}
127
131
128
132
const navigate = async ( elementOrPath : Element | string , basePath = '' ) : Promise < boolean > => {
129
133
const href = typeof elementOrPath === 'string' ? elementOrPath : elementOrPath . getAttribute ( 'href' ) ;
130
134
const [ path , params ] = ( basePath + href ) . split ( '?' ) ;
131
135
const queryParams = params
132
136
? params . split ( '&' ) . reduce ( ( qp , q ) => {
133
- const [ key , value ] = q . split ( '=' ) ;
134
- const currentValue = qp [ key ] ;
135
- if ( typeof currentValue === 'undefined' ) {
136
- qp [ key ] = value ;
137
- } else if ( Array . isArray ( currentValue ) ) {
138
- qp [ key ] = [ ...currentValue , value ] ;
139
- } else {
140
- qp [ key ] = [ currentValue , value ] ;
141
- }
142
- return qp ;
143
- } , { } as Record < string , string | string [ ] > )
137
+ const [ key , value ] = q . split ( '=' ) ;
138
+ const currentValue = qp [ key ] ;
139
+ if ( typeof currentValue === 'undefined' ) {
140
+ qp [ key ] = value ;
141
+ } else if ( Array . isArray ( currentValue ) ) {
142
+ qp [ key ] = [ ...currentValue , value ] ;
143
+ } else {
144
+ qp [ key ] = [ currentValue , value ] ;
145
+ }
146
+ return qp ;
147
+ } , { } as Record < string , string | string [ ] > )
144
148
: undefined ;
145
149
146
150
const navigateOptions : NavigationExtras | undefined = queryParams
147
151
? {
148
- queryParams,
149
- }
152
+ queryParams,
153
+ }
150
154
: undefined ;
151
155
152
156
const doNavigate = ( ) => {
@@ -411,7 +415,7 @@ if (typeof process === 'undefined' || !process.env?.ATL_SKIP_AUTO_CLEANUP) {
411
415
}
412
416
413
417
@Component ( { selector : 'atl-wrapper-component' , template : '' } )
414
- class WrapperComponent { }
418
+ class WrapperComponent { }
415
419
416
420
/**
417
421
* Wrap findBy queries to poke the Angular change detection cycle
0 commit comments