Skip to content
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

Add state to hash history #704

Closed
johnjesse opened this issue May 30, 2019 · 6 comments · Fixed by #751
Closed

Add state to hash history #704

johnjesse opened this issue May 30, 2019 · 6 comments · Fixed by #751
Labels

Comments

@johnjesse
Copy link

I'm currently in a similar position to that mentioned by @matthewrobb in #435, where I am limited to using the hash portion of the url for my dynamic application routing but I'm not limited in my support for older browsers and want to make use of storing state in the navigation whilst using hash urls.

I know #435 mentions a few workarounds to use browserHistory and basename but those workarounds feel like a bit of a hack and won't really work for me.

I am going to be putting together my own version of hashHistory that uses the browser history API and I was wondering if there would be any interest in adding that within to this library. I'd be happy to submit a PR to do it, but would need a bit of guidance on what approach to take here and what would need to be supported.

@pshrmn
Copy link
Contributor

pshrmn commented May 31, 2019

I discussed this a bit with @mjackson a few months ago and I believe that a future version of history will support state with hash histories (by dropping old browser support and using the History API), but I am not privy to when this will happen.

@mjackson
Copy link
Member

mjackson commented Aug 6, 2019

Yes, but it will have to happen in a future major version. We need to bump our browser support to be only browsers that support pushState. Then we can add state to hash history because it will use pushState under the hood.

@mjackson mjackson changed the title Question: Is there interest in supporting state in hash history? Add state to hash history Aug 6, 2019
@mjackson
Copy link
Member

Quick update here: we are planning on adding this feature in version 5.

@mjackson mjackson mentioned this issue Sep 10, 2019
25 tasks
mjackson added a commit that referenced this issue Nov 5, 2019
New features:
- Remove legacy browser support (pre pushState)
- Add state to hash history
- Use custom window when creating history objects
- Better history.block API (wip)
- Fix location.pathname encoding issues
- About 50% smaller
- No dependencies

Removed features:
- Removes basename support
- Removes getUserConfirmation
- Removes keyLength
- Removes hashType
- Removes relative pathname support in hash + memory histories

Still TBD:
- Missing pathname support in push/replace

Fixes #624
Fixes #704
Fixes #723
Fixes #726
@mjackson mjackson mentioned this issue Nov 5, 2019
Merged
@mjackson
Copy link
Member

mjackson commented Nov 8, 2019

Heads up: in the v5 beta released today you can now use state with hash history. Please give it a shot and LMK how it goes!

@johnjesse
Copy link
Author

johnjesse commented Nov 12, 2019

I've tried updated our project with it, removing my own simple implementation we've had for the last few months - I can see the browser state working correctly. I've got a couple of issues but I think they're to do with relative paths so I think it's looking good 👍

Thanks for doing this!

@matthewrobb
Copy link

Pretty awesome this is finally happening guys!

Even if it's after that project has long since ended and I don't do much React anymore :)

(*reserves package name svelte-react-router)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants