Skip to content

[go_router] fix: PopScope.onPopInvokedWithResult not called in branch routes #9245

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Gustl22
Copy link
Contributor

@Gustl22 Gustl22 commented May 13, 2025

If using PopScope inside StatefulShellRoute.indexedStack it is not called when on top most route.

flutter/flutter#138737 (comment)

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

@Gustl22 Gustl22 force-pushed the 138737-go-router-pop-scope branch from 4dc074a to f2b12ec Compare May 14, 2025 09:29
@Gustl22 Gustl22 marked this pull request as ready for review May 14, 2025 09:30
@Gustl22 Gustl22 requested a review from chunhtai as a code owner May 14, 2025 09:30
Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the approach is fine. just a nitpick

if (potentialCandidate.canPop()) {
state = walker.navigatorKey.currentState;
}
states.insert(0, potentialCandidate);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can do a reversed at the end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I updated the code to use reversed and iterable as return type.

@Gustl22 Gustl22 requested a review from chunhtai May 19, 2025 12:49
Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chunhtai chunhtai requested a review from hannah-hyj May 22, 2025 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants