Skip to content

fix(routing): resolve direct/path-based deep links to hash routes#676

Open
Zhekinmaksim wants to merge 1 commit into
genlayer-foundation:devfrom
Zhekinmaksim:fix/614-hash-routing-deep-links
Open

fix(routing): resolve direct/path-based deep links to hash routes#676
Zhekinmaksim wants to merge 1 commit into
genlayer-foundation:devfrom
Zhekinmaksim:fix/614-hash-routing-deep-links

Conversation

@Zhekinmaksim
Copy link
Copy Markdown

Closes #614.

The portal uses hash-based routing (svelte-spa-router), but several sidebar links render as plain path URLs (/testnets, /metrics, ...). When opened in a new tab, copied/shared, refreshed, or indexed, these arrive without a hash and resolve to a 404/NotFound.

Changes:

  • Add src/lib/normalizePath.js: route-agnostic path-to-hash normalization. Unknown paths fall through to the router's own NotFound; static assets and server-handled prefixes (/api, /oauth, ...) are left untouched. Replaces the previous hardcoded two-prefix block in App.svelte.
  • Sidebar.svelte: convert internal hrefs to hash form so copied/new-tab/indexed links are valid at the source.
  • src/tests/normalizePath.test.js: unit coverage (11 tests).

Verified: new tests pass, npm run build succeeds, no new regressions in the existing suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Portal sidebar deep links return 404 when opened directly

1 participant