(
segments: string[] | null,
direction: RouterDirection,
animation?: AnimationBuilder
)
| 252 | } |
| 253 | |
| 254 | private async writeNavStateRoot( |
| 255 | segments: string[] | null, |
| 256 | direction: RouterDirection, |
| 257 | animation?: AnimationBuilder |
| 258 | ): Promise<boolean> { |
| 259 | if (!segments) { |
| 260 | printIonError('[ion-router] - URL is not part of the routing set.'); |
| 261 | return false; |
| 262 | } |
| 263 | |
| 264 | // lookup redirect rule |
| 265 | const redirects = readRedirects(this.el); |
| 266 | const redirect = findRouteRedirect(segments, redirects); |
| 267 | |
| 268 | let redirectFrom: string[] | null = null; |
| 269 | |
| 270 | if (redirect) { |
| 271 | const { segments: toSegments, queryString, fragment } = redirect.to!; |
| 272 | this.setSegments(toSegments, direction, queryString, fragment); |
| 273 | redirectFrom = redirect.from; |
| 274 | segments = toSegments; |
| 275 | } |
| 276 | |
| 277 | // lookup route chain |
| 278 | const routes = readRoutes(this.el); |
| 279 | const chain = findChainForSegments(segments, routes); |
| 280 | if (!chain) { |
| 281 | printIonError('[ion-router] - The path does not match any route.'); |
| 282 | return false; |
| 283 | } |
| 284 | |
| 285 | // write DOM give |
| 286 | return this.safeWriteNavState(document.body, chain, direction, segments, redirectFrom, 0, animation); |
| 287 | } |
| 288 | |
| 289 | private async safeWriteNavState( |
| 290 | node: HTMLElement | undefined, |
no test coverage detected