diff --git a/src/client/app/router.ts b/src/client/app/router.ts index 0e04703e..3c6fb4f7 100644 --- a/src/client/app/router.ts +++ b/src/client/app/router.ts @@ -29,6 +29,10 @@ export interface Router { * updated). Return `false` to cancel the navigation. */ onBeforePageLoad?: (to: string) => Awaitable + /** + * Called after the page component is loaded (before the page component is updated). + */ + onAfterPageLoad?: (to: string) => Awaitable /** * Called after the route changes. */ @@ -94,6 +98,8 @@ export function createRouter( throw new Error(`Invalid route component: ${comp}`) } + await router.onAfterPageLoad?.(href) + route.path = inBrowser ? pendingPath : withBase(pendingPath) route.component = markRaw(comp) route.data = import.meta.env.PROD