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 <[email protected]> * 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 <[email protected]> --------- Co-authored-by: Rotimi Best <[email protected]>
This commit is contained in:
co-authored by
Rotimi Best
parent
c03c08fc84
commit
f181bb483a
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user