From ca25e32c0f4de45584982eeb4bad9f2fa5422b8a Mon Sep 17 00:00:00 2001 From: Jack Hanford Date: Tue, 23 Nov 2021 16:23:31 -0500 Subject: fix shallow routing --- packages/bun-framework-next/client.development.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/bun-framework-next/client.development.tsx b/packages/bun-framework-next/client.development.tsx index 187a91e71..29774d1b5 100644 --- a/packages/bun-framework-next/client.development.tsx +++ b/packages/bun-framework-next/client.development.tsx @@ -52,8 +52,6 @@ import { export const emitter: MittEmitter = mitt(); -const App = NextApp; - declare global { interface Window { /* test fns */ @@ -293,6 +291,7 @@ export async function _boot(EntryPointNamespace, isError) { // Construct signature return types 'App' and 'Component' are incompatible. // @ts-expect-error CachedApp = NextApp; + CachedComponent = PageComponent; if (appScripts && appScripts.length > 0) { let appSrc; @@ -329,9 +328,12 @@ export async function _boot(EntryPointNamespace, isError) { return render( Object.assign< {}, - Omit, - Pick + Omit, + Pick >({}, info, { + // If we don't have an info.Component, we may be shallow routing, + // fallback to current entry point + Component: info.Component || CachedComponent, App, scroll, }) -- cgit v1.2.3