Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/router/src/RouterView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function RouterView({ router }: RouterViewProps) {
progress: number;
}>({
previous: null,
current: router.current ? router._wrapScreen(router.current) : null,
current: router.current ? router.wrapScreen(router.current) : null,
direction: 'push',
progress: 1,
});
Expand Down
11 changes: 6 additions & 5 deletions packages/router/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ export class Router {
}
}

_wrapScreen(match: RouteMatch): VNode {
/** Wrap a route match into a VNode with layout chain and providers */
wrapScreen(match: RouteMatch): VNode {
let screen = createElement(match.route.component, match.params);

for (let i = match.chain.length - 2; i >= 0; i--) {
Expand Down Expand Up @@ -267,7 +268,7 @@ export class Router {
const notFoundMatch = this._createNotFoundMatch(resolvedPath);
this._currentMatch = notFoundMatch;
if (this.autoUnmount) unmountAll();
const screen = this._wrapScreen(notFoundMatch);
const screen = this.wrapScreen(notFoundMatch);
const emitEvent = direction === 'back' ? 'back' : 'navigate';
this.events.emit(emitEvent, { match: notFoundMatch, screen, direction });
return;
Expand Down Expand Up @@ -310,7 +311,7 @@ export class Router {

this._currentMatch = match;
if (this.autoUnmount) unmountAll();
const screen = this._wrapScreen(match);
const screen = this.wrapScreen(match);

const emitEvent = direction === 'back' ? 'back' : 'navigate';
this.events.emit(emitEvent, { match, screen, direction });
Expand Down Expand Up @@ -379,7 +380,7 @@ export class Router {

this._currentMatch = match;
if (this.autoUnmount) unmountAll();
const screen = this._wrapScreen(match);
const screen = this.wrapScreen(match);

this.events.emit('back', { match, screen, direction: 'back' });

Expand Down Expand Up @@ -414,7 +415,7 @@ export class Router {
this._history.push(nextPath);
this._currentMatch = match;
if (this.autoUnmount) unmountAll();
const screen = this._wrapScreen(match);
const screen = this.wrapScreen(match);
this.events.emit('navigate', { match, screen, direction: 'forward' });

match.route.afterEnter?.(nextPath);
Expand Down
Loading