fix: SPA router ignores trailing slash, breaking direct URL visits (#441)#442
Conversation
GitHub Pages 301-redirects /workflow to /workflow/ when workflow/index.html is served as a directory index. The SPA router looked up the trailing-slash form in the route map and missed the '/workflow' key, falling through to the home handler and overwriting the pre-rendered doc content. Normalize trailing slashes in handleRoute() before lookup. Also un-skip the direct-URL test (pre-rendering removed the need for a 404.html fallback) and add a regression test for the trailing-slash case. Closes LLM-Coding#441
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughDer Router normalisiert nun Pfade mit nachgestelltem Schrägstrich in der Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #441
Problem
Direct visits to clean routes (e.g.
https://llm-coding.github.io/Semantic-Anchors/workflow) landed on the home page instead of the target page. In-app navigation worked; only direct URL entry broke.Root cause
GitHub Pages 301-redirects
/workflow→/workflow/whenworkflow/index.htmlis served as a directory index. After the redirect,window.location.pathnameends in a trailing slash. The router'sroutes.get('/workflow/')lookup missed the/workflowkey and fell through to the home-page fallback, which wiped out the pre-rendered doc content.Affected routes:
/workflow,/brownfield,/about,/changelog,/contributing,/agentskill,/rejected-proposals,/all-anchors,/evaluations.Fix
Normalize the trailing slash in
handleRoute()before looking up the handler. Root path/remains unchanged.Tests (Red/Green TDD)
should render doc page when visited via trailing-slash URL— goes to/Semantic-Anchors/workflow/and asserts workflow content (not cards) renders.should handle direct URL to About page— the stale skip comment referenced a 404.html fallback that's been superseded by per-route pre-rendering.Verified Red on base branch (test fails without the router fix), Green after the change.
Test plan
Summary by CodeRabbit
Bug Fixes
/workflow/werden nun konsistent mit ihrer Entsprechung ohne Schrägstrich (/workflow) aufgelöst, was die Zuverlässigkeit der Routenauflösung verbessert.Tests