-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[go_router] Implement popUntil
#2728
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
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4a809f3
:sparkles: Add popUntil
ValentinVignal 0047433
:white_check_mark: Test popUntil
ValentinVignal 4196431
:memo: Update the documentation
ValentinVignal 701d26d
Merge branch 'main' into go-router/pop-until
ValentinVignal ab21137
Merge remote-tracking branch 'upstream/main' into go-router/pop-until
ValentinVignal f9e08c2
:recycle: Call pop repeatedly
ValentinVignal 51395cd
:memo: Update the documentation
ValentinVignal 43ec575
:white_check_mark: Update the tests
ValentinVignal 97cbf4e
Merge branch 'main' into go-router/pop-until
ValentinVignal 59b89cd
Merge remote-tracking branch 'upstream/main' into go-router/pop-until
ValentinVignal 2c48f39
:alembic: Use navigator pop until
ValentinVignal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the current implementation (simply calling
pop
, the notifiers are notified for eachpop
). In this case, 2 times. Is it correct or should the router delegate notify only once?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may need to refactor the code a bit, every time it notify the listener, the Gorouter will also notify its listener about location change, so if url = '/a/b/c/d/e' and popUtil to '/a'
if we notify each time it pop
goRoute will notify its listener with
'/a/b/c/d'
'/a/b/c'
'/a/b'
'/a'
instead just
'/a'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, to be correct, this test should pass with
count: 1
, is that correct?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @chunhtai , I'm not sure it will be possible to notify the listeners only once even when popping several times (and make the test pass with
count: 1
).I pushed some code in 2c48f39 . Itis not correct as I guess it doesn't work with multiple nested navigators, it's more of a demonstration example. it uses directly
popUntil
from theNavigatorState
and it still notifies the listeners twice.Or would you know a way to make this work?