From f181bb483adf0f30fcd3e4e909486ed4b39fcad2 Mon Sep 17 00:00:00 2001 From: Rotimi Best Date: Sun, 12 Jul 2026 09:14:55 +0100 Subject: [PATCH] fix(website): cache GitHub stars on server and show in nav (#734) * fix(website): cache GitHub stars on server for 3 hours Move star count fetching from universal +layout.ts to server-only code so the GitHub API is not called on every page load or client navigation. Add an in-memory cache with a 3-hour TTL and in-flight request deduplication. On API errors (including rate limits), return the last successful value when available. Co-authored-by: Rotimi Best * fix(website): forward GitHub stars from server load to layout Universal +layout.ts was shadowing +layout.server.ts data, so stars never reached +layout.svelte and the nav rendered an empty span. Co-authored-by: Rotimi Best --------- Co-authored-by: Rotimi Best --- apps/website/src/routes/+layout.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/website/src/routes/+layout.ts b/apps/website/src/routes/+layout.ts index c3e77618..d55a2b2b 100644 --- a/apps/website/src/routes/+layout.ts +++ b/apps/website/src/routes/+layout.ts @@ -2,8 +2,9 @@ import type { MetaTagsProps } from 'svelte-meta-tags'; export const prerender = true; -export async function load({ url }) { +export async function load({ data, url }) { return { + stars: data.stars, baseMetaTags: getBaseMetaTags(url), url: url.pathname };