Skip to content

Feat: proper rendering of href when using useHashLocation#421

Merged
molefrog merged 4 commits intov3from
feat/hash-links
Mar 11, 2024
Merged

Feat: proper rendering of href when using useHashLocation#421
molefrog merged 4 commits intov3from
feat/hash-links

Conversation

@molefrog
Copy link
Owner

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.

@molefrog molefrog requested a review from jeetiss February 27, 2024 12:00
@bolt-new-by-stackblitz
Copy link

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

@github-actions
Copy link

github-actions bot commented Feb 27, 2024

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
Copy link

codecov bot commented Feb 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

❗ 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
@@            Coverage Diff            @@
##                v3      #421   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines            1         1           
=========================================
  Hits             1         1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@jeetiss jeetiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💅

@molefrog molefrog merged commit 5cfa1c7 into v3 Mar 11, 2024
@molefrog molefrog deleted the feat/hash-links branch March 11, 2024 09:59
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.

v3.0.0-rc.1: When use hash router, Ctrl+click on <Link>, new window is opened with wrong url

2 participants