This repository was archived by the owner on Feb 25, 2022. It is now read-only.
How to implement something like "pop if possible, else go" #333
Unanswered
bw-flagship
asked this question in
Q&A
Replies: 1 comment 1 reply
-
You can get the current stack size with something like: |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
``I have a scenario where I struggle to find the correct solution with go_router.
Imagine I have a BookListView (with a state, e.g. my scroll position) and a BookDetailView with the bookId as a route parameter.
The BookDetailView contains a back-button. When I press it, I want to navigate to the BookListView.
When comming from the BookListView, I archive this via pop().
However, when I access the BookDetailView via deeplink, I need to use context.go(…), because the BookListView does not exist in the stack.
I can't always use context.go because I would lose the state of my BookListView.
I would need something like:
Right now I solve it like this:
But it feels very wrong. What would be the better way?
Thanks alot!
Beta Was this translation helpful? Give feedback.
All reactions