Skip to content

Commit 8e673e4

Browse files
cevhericlaude
andcommitted
fix: address Copilot PR review (cross-route nav anchors, test isolation, doc accuracy)
- Header + Footer in-page nav anchors were hash-only (#features), which scroll to nothing when rendered on /deploy and other sub-pages. Changed to /#... so they navigate back to the homepage sections from any route. - github-stars.test.ts assigned globalThis.fetch directly; mock.restore() doesn't revert that. Capture and restore the original fetch in afterEach. - Corrected getStars JSDoc: it's build-time only (sets a User-Agent header browsers forbid); the client refresh does its own header-free fetch. Declined (verified non-issues): the querySelectorAll<HTMLElement> generics in the deploy.astro client script — Astro transpiles <script> via esbuild, which strips TS types; dist contains zero 'querySelectorAll<' and the build passes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 1815e0d commit 8e673e4

4 files changed

Lines changed: 15 additions & 9 deletions

File tree

src/components/Footer.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ const sections = [
66
id: "product",
77
title: "Product",
88
links: [
9-
{ label: "Features", href: "#features" },
10-
{ label: "Databases", href: "#databases" },
11-
{ label: "Tech Stack", href: "#tech-stack" },
9+
{ label: "Features", href: "/#features" },
10+
{ label: "Databases", href: "/#databases" },
11+
{ label: "Tech Stack", href: "/#tech-stack" },
1212
{ label: "Deploy", href: "/deploy" },
1313
{ label: "Live Demo", href: "https://app.libredb.org", external: true },
1414
],

src/components/Header.astro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
<!-- Desktop Navigation -->
1515
<div class="hidden md:flex items-center gap-8">
16-
<a href="#features" class="text-slate-400 hover:text-white transition-colors text-sm font-medium">Features</a>
17-
<a href="#databases" class="text-slate-400 hover:text-white transition-colors text-sm font-medium">Databases</a>
18-
<a href="#tech-stack" class="text-slate-400 hover:text-white transition-colors text-sm font-medium">Tech Stack</a>
19-
<a href="#get-started" class="text-slate-400 hover:text-white transition-colors text-sm font-medium">Get Started</a>
16+
<a href="/#features" class="text-slate-400 hover:text-white transition-colors text-sm font-medium">Features</a>
17+
<a href="/#databases" class="text-slate-400 hover:text-white transition-colors text-sm font-medium">Databases</a>
18+
<a href="/#tech-stack" class="text-slate-400 hover:text-white transition-colors text-sm font-medium">Tech Stack</a>
19+
<a href="/#get-started" class="text-slate-400 hover:text-white transition-colors text-sm font-medium">Get Started</a>
2020
<a href="/deploy" class="text-slate-400 hover:text-white transition-colors text-sm font-medium">Deploy</a>
2121
</div>
2222

src/lib/github-stars.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ import { test, expect, mock, afterEach } from 'bun:test';
22
import { formatStars, getStars, FALLBACK_STARS } from './github-stars';
33
import { starRepos } from '../data/deploy-targets';
44

5+
// Tests assign globalThis.fetch directly (not spyOn), which mock.restore()
6+
// does not revert — capture and restore the original to keep tests isolated.
7+
const originalFetch = globalThis.fetch;
58
afterEach(() => {
69
mock.restore();
10+
globalThis.fetch = originalFetch;
711
});
812

913
test('formatStars renders compact counts', () => {

src/lib/github-stars.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ export function formatStars(n: number): string {
2828
}
2929

3030
/**
31-
* Fetch star counts for each repo. Runs at build time (Node) and is safe to
32-
* call from a browser too. Any failure falls back to FALLBACK_STARS (or 0).
31+
* Fetch star counts for each repo. Build-time only (Node): it sets a
32+
* `User-Agent` header, which browsers forbid — the client refresh script in
33+
* deploy.astro does its own header-free fetch instead. Any failure falls back
34+
* to FALLBACK_STARS (or 0).
3335
*/
3436
export async function getStars(repos: string[]): Promise<Record<string, number>> {
3537
const entries = await Promise.all(

0 commit comments

Comments
 (0)