Skip to content

Commit

Permalink
Merge pull request #28 from AurelienLourot/aurelien/fix/client-routin…
Browse files Browse the repository at this point in the history
…g-empty-title

fix: possibly unset document title on client routing
  • Loading branch information
magne4000 authored Oct 25, 2023
2 parents f206d94 + 9358204 commit 8b79a1d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions vike-solid/renderer/+onRenderClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,23 @@ const onRenderClient: OnRenderClientAsync = async (

const container = document.getElementById("page-view")!;
if (container.innerHTML !== "" && pageContext.isHydration) {
// Hydration
dispose = hydrate(() => getPageElement(pageContextStore)!, container);
} else {
// First rendering
dispose = render(() => getPageElement(pageContextStore)!, container);
}
rendered = true;
} else {
// Client routing
// See https://vike.dev/server-routing-vs-client-routing

setPageContext(reconcile(pageContext));
}

const title = getTitle(pageContext);
if (title !== null) {
document.title = title;
// Get the page's `title` config value, which may be different from the
// previous page. It can even be null, in which case we should unset the
// document title.
const title = getTitle(pageContext);
document.title = title || "";
}
}
};

0 comments on commit 8b79a1d

Please sign in to comment.