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

Why history.length is gone? #960

Open
baeharam opened this issue Aug 11, 2022 · 7 comments
Open

Why history.length is gone? #960

baeharam opened this issue Aug 11, 2022 · 7 comments

Comments

@baeharam
Copy link

I'm migrating from react-router-domv5 to v6, and encountered that history.length is no longer supported in history v5. In this situation, I have several questions.

  1. Why history.length is gone? Is there some contexts related to about this?
  2. How can I replace this feature? (= substitution..?)

I looked for lots of channels(SO, RRD github issue, history github issue, googling etc...) but couldn't find out the reason and solution.
Thanks for your reading.

@Nantris
Copy link

Nantris commented Aug 26, 2022

Doesn't seem to be mentioned in the changelog, but yeah that's surprising.

@janyin
Copy link

janyin commented Sep 13, 2022

Use window.history.length

@Nantris
Copy link

Nantris commented Sep 13, 2022

Thanks for the tip but that won't help when the chosen history type is MemoryHistory.

@baeharam
Copy link
Author

I think this change should be mentioned in docs. Additionally, if you use unstable_HistoryRouter in version 6.3, you can use window.history.length probably.

@KingAmo
Copy link

KingAmo commented Aug 1, 2023

how to get history.length ?
react-router-dom: 6.14.2 and createBrowserRouter

@rumi-ju
Copy link

rumi-ju commented Feb 6, 2024

Does anyone know how to know history.length?

@Nantris
Copy link

Nantris commented Feb 6, 2024

There's been a PR open for this for two years. It's adds 4 lines of code and reverts an undocumented change. My perception is that the maintainers just don't care. You're on your own. I waited hopefully for a long time.

I won't ever use this library for future projects.

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

No branches or pull requests

5 participants