molefrog / wouter

🥢 A minimalist-friendly ~2.1KB routing for React and Preact
https://npm.im/wouter
The Unlicense
6.65k stars 152 forks source link

Feat: proper rendering of `href` when using `useHashLocation` #421

Closed molefrog closed 6 months ago

molefrog commented 7 months ago

Closes #392 #215

A long-awaited feature that makes it possible to have proper hrefs with the leading # when hash location is used. You can customise the formatter manually:

<Router hrefs={(href) => "#" + href} />

Or, it can be detected automatically when useHashLocation is used.

stackblitz[bot] commented 7 months ago

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

github-actions[bot] commented 7 months ago

size-limit report 📦

Path Size
packages/wouter/esm/index.js 2.14 KB (+1.02% 🔺)
packages/wouter/esm/use-browser-location.js 658 B (0%)
packages/wouter/esm/memory-location.js 834 B (0%)
packages/wouter/esm/use-hash-location.js 749 B (+1.63% 🔺)
packages/wouter-preact/esm/index.js 2.02 KB (+1.08% 🔺)
packages/wouter-preact/esm/use-browser-location.js 552 B (0%)
packages/wouter-preact/esm/use-hash-location.js 618 B (+1.82% 🔺)
packages/wouter-preact/esm/memory-location.js 702 B (0%)
codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (6815e69) to head (7546d1a).

:exclamation: Current head 7546d1a differs from pull request most recent head 7d06bd6. Consider uploading reports for the commit 7d06bd6 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## v3 #421 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 1 1 Lines 1 1 ========================================= Hits 1 1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.