S
SolidJS•2mo ago
jack

subroute not rendering on client nav

I recently started a new branch to add a 3rd party Clerk solid integration to my app, and all of a sudden, all pages that are children of one layout won't render on client nav. i assumed something was wrong with the new dep i added, but i got rid of all references to that and then created a new page in this sub layout, but this also fails to render on client nav. they always all work on full page reload. i assume that it's due to the layout in question, though it looks entirely normal to me (the other layout's subpages render fine on client nav, which is why i think this is the root of the issue)
export default function RootLayout(props: RouteSectionProps) {
const params = useParams<{ username: string }>();
onMount(destroyToasters);

return (
<main class="z-10 flex flex-col px-4 pt-8 pb-16 mx-auto text-center gap-5 sm:min-w-96 w-full max-w-screen-md">
<Show when={useLocation().pathname} keyed>
<Suspense
fallback={<UsernamePageSkeleton username={params.username} />}
>
{props.children}
</Suspense>
</Show>
<Toaster regionId="app-toaster" />
</main>
);
}
export default function RootLayout(props: RouteSectionProps) {
const params = useParams<{ username: string }>();
onMount(destroyToasters);

return (
<main class="z-10 flex flex-col px-4 pt-8 pb-16 mx-auto text-center gap-5 sm:min-w-96 w-full max-w-screen-md">
<Show when={useLocation().pathname} keyed>
<Suspense
fallback={<UsernamePageSkeleton username={params.username} />}
>
{props.children}
</Suspense>
</Show>
<Toaster regionId="app-toaster" />
</main>
);
}
honestly have no clue what's going on here and it's super difficult to debug this it seems, nothing interesting is really happening in console.
4 Replies
jack
jackOP•2mo ago
just bumping this 🙂
REEEEE
REEEEE•2mo ago
Could be possible it's due to useLocation().pathname being used inline like that
Madaxen86
Madaxen86•2mo ago
Also: Show with keyed might expect a callback as children. What does the Show with location.pathname do anyways?
jack
jackOP•2mo ago
It was recommended a bit back to me, I believe to deal with in-layout navigation If I remember correctly Basically forces the layout to rerun when pathname changes, otherwise my suspense fallback wouldn’t run after initial nav to this sub path I’ll try and find the thread
Want results from more Discord servers?
Add your server