From 99fb1e2ff0bc3ad6ff5417efe05cd5f27bacdd61 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Thu, 18 Jun 2026 16:35:52 +0800 Subject: [PATCH 1/2] chore: ignore local TODO planning artifacts Local planning/scratch files (TODO.clean/, docs/TODO.*.md) should never be committed. The TODO* pattern catches them anywhere in the tree. --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 0ec8d86c6..ad1059e1a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,7 @@ .rubocop-* CLAUDE.md +# Local planning artifacts — never commit +TODO* +**/TODO* + From bbe4bc9cf92c049fe375a2eb8c0b881799aa31a8 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Thu, 18 Jun 2026 16:35:52 +0800 Subject: [PATCH 2/2] fix(docs): eliminate slash flash on browse navigation When clicking a search result on the homepage or /browse/, the URL bar briefly showed /browse/foo/ then flashed to /browse/foo. Caused by a mismatch between the URL we navigate to and VitePress's route map: - cleanUrls: true generates a route map with /browse/foo (no slash) - build.js rewrites foo.html -> foo/index.html so the server serves /browse/foo/ as well - When user lands at /browse/foo/, VitePress client hydrates, sees the URL doesn't match its route map, and calls router.replace() to normalize -> visible URL bar flash. Fix: navigate WITHOUT trailing slash. Per VitePress routing docs, GitHub Pages supports clean URLs by default -- it serves /browse/foo/index.html for both /browse/foo/ and /browse/foo. Old bookmarks keep working. Also fixes the relative-vs-absolute href inconsistency: FormulaBrowser used relative 'slug + \'/\'' while the homepage used absolute. FormulaBrowser now uses absolute 'basePath + browse + slug'. Bonus: matches the canonical URL emitted by transformHead in config.ts (which already omits the trailing slash), improving SEO consistency. Files changed: - docs/index.md: 3 sites (autocomplete click, Enter key, href) - docs/.vitepress/theme/FormulaBrowser.vue: 2 sites (function + href) - Hoisted basePath to top-level script setup for template access --- docs/.vitepress/theme/FormulaBrowser.vue | 8 +++++--- docs/index.md | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/.vitepress/theme/FormulaBrowser.vue b/docs/.vitepress/theme/FormulaBrowser.vue index df6860375..6582edd99 100644 --- a/docs/.vitepress/theme/FormulaBrowser.vue +++ b/docs/.vitepress/theme/FormulaBrowser.vue @@ -7,6 +7,7 @@ const formulasData = ref([]) const searchQuery = ref('') const selectedLicenses = ref(['all']) const selectedSources = ref(['all']) +const basePath = import.meta.env.BASE_URL || '/' const licenseOptions = [ { value: 'all', label: 'All Licenses', icon: 'all', count: 0 }, @@ -211,8 +212,9 @@ function goToFormula(slug) { // "Page not found" 404 even though the SSR HTML exists on the server. // Bypass SPA routing for formula clicks — full page load fetches the // correct HTML which loads the correct app chunk for that formula's batch. - const basePath = import.meta.env.BASE_URL || '/' - window.location.href = `${basePath}browse/${slug}/` + // No trailing slash: cleanUrls:true route map expects /browse/foo, and + // GitHub Pages serves /browse/foo/index.html for either form. + window.location.href = `${basePath}browse/${slug}` } function toggleLicense(value) { @@ -266,7 +268,7 @@ function toggleSource(value) {