-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore [v5] HashRouter 'hashType' prop #8450
Conversation
Hi @thejohnhoffer, Welcome, and thank you for contributing to React Router! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at hello@remix.run. Thanks! - The Remix team |
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
This isn't necessary. Just provide a There were other modes of HashRouter/History that aren't covered by this PR, so it's not actually bringing back a compatible API. It's only solving for a specific case. |
Using react-router/packages/react-router/index.tsx Line 270 in c68df0c
react-router/packages/react-router/index.tsx Lines 1303 to 1304 in c68df0c
|
@jtojnar Thanks to react-router-dom@6.1.1, here's a quick workaround! It's possible the maintainers will feel |
Resolves #7703
Context
The v5 API page documenting
HashRouter
allows hashes to begin as#
rather than#/
. The v6HashRouter
no longer supports this because history@5 lost that property of history@4. Ten days ago, a contributor closed #7703. The contributor suggested the issue should be brought to the attention of with remix-run/history/, but noted "it was specifically removed in v5" ofhistory
while warning "it's not likely to return."This is a request to replicate that feature of
HashRouter
that we lost inhistory@5
andreact-router@6
.Solution
Only when
<Router basename="">
, this PR now supportsTo
objects without a leading slash. Since the v5 docs claim that a "properly formatted basename should have a leading slash," this PR has no change to documented usage.To support
<HashState hashType="noslash">
, that syntax is mapped to<Router basename="">
.So, the concept of a
hashType
is limited to theHashState
constructor.