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

Ability to check if a router has any pages to go back/forward to #2177

Closed
Bertie2011 opened this issue Mar 18, 2024 · 1 comment
Closed

Ability to check if a router has any pages to go back/forward to #2177

Bertie2011 opened this issue Mar 18, 2024 · 1 comment

Comments

@Bertie2011
Copy link

What problem is this solving

I'm building an app where routers (and their views) are placed within virtual windows within the app. The windows have their own back/forwards buttons and it seems that I have no way of knowing if there are any pages to go back or forwards to.

Proposed solution

  • Exposing extra methods on router/history could be very useful (e.g. canGoBack, canGoForwards).
  • Another option would be adding some kind of indicator to what happens to history state in listener callbacks, so I can track a counter myself.
  • Or give access to the full browser history stack (which I guess is only an issue for the memory history), but a simple number or boolean would suffice for my use-case.

Describe alternatives you've considered

I looked in the API docs and couldn't find any useful methods/fields on the router/history.

Copy link
Member

posva commented Mar 18, 2024

This has been requested before. There is no native api to check for that but you can write to history.state after each navigation to create the behavior you want

@posva posva closed this as not planned Won't fix, can't repro, duplicate, stale Mar 18, 2024
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

2 participants