[go_router] Fix replace routes hanging the originating completer
The behavior of replace and pushReplacement involves popping the last route and ignoring the completer, leaving the last route's future unresolved. This PR introduces new behavior for both methods to inherit the last route's completer if the last route is an ImperativeRouteMatch.
Expected issue(s) should be fixed by this:
- https://github.com/flutter/flutter/issues/141251
Previous behavior:
https://github.com/user-attachments/assets/add06187-9bee-4347-8eac-e129c7a53457
This PR behavior:
https://github.com/user-attachments/assets/98c20fe3-5fea-4db2-ae95-747950650172
Pre-Review Checklist
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I read the Tree Hygiene page, which explains my responsibilities.
- [x] I read and followed the relevant style guides and ran the auto-formatter.
- [x] I signed the CLA.
- [x] The title of the PR starts with the name of the package surrounded by square brackets, e.g.
[shared_preferences] - [x] I linked to at least one issue that this PR fixes in the description above.
- [x] I updated
pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under[^1]. - [x] I updated
CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under[^1]. - [x] I updated/added any relevant documentation (doc comments with
///). - [x] I added new tests to check the change I am making, or I have commented below to indicate which test exemption this PR falls under[^1].
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel on Discord.
[^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.
@nouvist LGTM, thank you for submitting the fix, I was facing the same issue
@nouvist Do you still plan to return to this PR? FYI there are merge conflicts now.
@nouvist I'm going to close this PR as abandoned, but let me know if you end up getting time to return to it and want to reopen.