Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: removeRoute now call didComplete#157725

Merged
auto-submit[bot] merged 25 commits intoflutter:masterfrom
EArminjon:fix-expose-did-complete
Feb 12, 2025
Merged

feat: removeRoute now call didComplete#157725
auto-submit[bot] merged 25 commits intoflutter:masterfrom
EArminjon:fix-expose-did-complete

Conversation

@EArminjon
Copy link
Contributor

@EArminjonEArminjon commentedOct 28, 2024
edited
Loading

(edited 4 december) PR EDITED TO FIT LATEST COMMENTS

Developper may want to remove a route in the background while an other one is displayed.
To do so, developer can use removeRoute().

RemoveRoute() didn't resolve futures created by Navigator.push and so code which await for Navigator.push will never end.

By calling complete() inside removeRoute, futures are well resolved. In addition that also allow to pass some result through removeRoute.

Ex:

Navigator.of(context).removeRoute(route,"test");Navigator.of(context).removeRoute(route, object);

This PR aim to fix this issue :#157505

Pre-launch Checklist

@github-actionsgithub-actionsbot added frameworkflutter/packages/flutter repository. See also f: labels. f: routesNavigator, Router, and related APIs. labelsOct 28, 2024
@EArminjonEArminjonforce-pushed thefix-expose-did-complete branch 2 times, most recently fromd6074ed to01e9627CompareOctober 28, 2024 15:29
@EArminjonEArminjon marked this pull request as ready for reviewOctober 28, 2024 17:01
Copy link
Contributor

@nate-thegratenate-thegrate left a comment

Choose a reason for hiding this comment

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

Maybe removeRoute should call didComplete internally but i didn't know what are the potential drawbacks.

I think this is a really good point.

If letting the Future hang forever is desired behavior for some reason, it probably makes sense to leave things as-is, given the workaround shown in#157505 (comment). Otherwise, I think it makes sense to unconditionally complete the future when the route is removed.

@chunhtaichunhtai self-requested a reviewOctober 30, 2024 18:23
@Piinks
Copy link
Contributor

(PR Triage): Hey@EArminjon, thanks for sending another PR! Would you like to continue working on this change and address the feedback above? Thanks!

@EArminjon
Copy link
ContributorAuthor

EArminjon commentedNov 20, 2024
edited
Loading

Sorry for delay, I can try.

@EArminjonEArminjonforce-pushed thefix-expose-did-complete branch 3 times, most recently fromcdf2970 to2b2fdf9CompareNovember 20, 2024 10:24
@EArminjonEArminjon changed the titlefix-expose-did-completefeat: remouteRoute now call didCompleteNov 20, 2024
@EArminjonEArminjonforce-pushed thefix-expose-did-complete branch 2 times, most recently from5074b2e to0eee47bCompareNovember 20, 2024 10:42
@EArminjon
Copy link
ContributorAuthor

@Piinks done :)

@EArminjon
Copy link
ContributorAuthor

EArminjon commentedNov 20, 2024
edited
Loading

I didn't know if we must consider this as a breaking change. If someone created a logic around the fact that .push() will never be completed when using removeRoute, now it will be.

nate-thegrate

This comment was marked as resolved.

nate-thegrate

This comment was marked as resolved.

@goderbauergoderbauer changed the titlefeat: remouteRoute now call didCompletefeat: removeRoute now call didCompleteNov 26, 2024
Comment on lines 2785 to 2787
/// [NavigatorObserver.didRemove]). The removed route is disposed without
/// being notified. The future that had been returned from pushing thatroutes
/// being notified. The future that had been returned from pushing thatroute
/// will not complete.
Copy link
Contributor

Choose a reason for hiding this comment

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

It does feel a bit weird thatremoveRouteBelow is no longer consistent withremoveRoute. Should we change all of these methods to complete their respective futures?

EArminjon reacted with thumbs up emoji
Copy link
ContributorAuthor

@EArminjonEArminjonDec 4, 2024
edited
Loading

Choose a reason for hiding this comment

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

pushAndRemoveUntil, restorablePushAndRemoveUntil, restorablePushNamedAndRemoveUntil and pushAndRemoveUntil could be supported but we need to add an extra logique like a callback to let developper choose to override the value ofdidComplete(result). if the callback is not provided we can fallback to null.

Maybe that can take place into an future pull request because that will also touch popUntil.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

PR edited to support removeRouteBelow.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

We can also go forward and try to support all method like replace, restorable etc.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Must i support them all inside this PR with the risk to delay massively it or should i create a dedicated PR later ? (New unit test will be needed, lot of changes)

Copy link
Contributor

Choose a reason for hiding this comment

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

Must I support them all inside this PR with the risk of a massive delay, or should I create a dedicated PR later?

That's a really good question.

I suppose my question would be: is it all right forremoveRoute &removeRouteBelow to both complete their respective futures, but for none of the other similar methods to do this?

If we merge this pull request today and there end up being issues with migrating the similar methods, I think the API would be more inconsistent than it is now.

Copy link
Contributor

Choose a reason for hiding this comment

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

pushAndRemoveUntil, restorablePushAndRemoveUntil, restorablePushNamedAndRemoveUntil and pushAndRemoveUntil could be supported but we would need to add extra logic, like a callback, to give the developer an option to override the value ofdidComplete(result); if the callback is not provided we can fallback to null.

My opinion as of now is that it'd be best for each removed route to have its future completed, but we can just dodidComplete(null) for now. If we wantpushAndRemoveUntil to support completing with a value, that can be saved for a future PR.

Does that sound okay to you?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

That could be a great roadmap : first time didComplete(null) by default, next PR logic to well handle that everywhere.

nate-thegrate reacted with rocket emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I tested quickly on my side, I can well update all these functions to support theresult property, and when needed, a dedicated callback for whose related to popUntil and removeUntil. Will do that later in dedicated PR (if you and reviewer agree).

Copy link
Contributor

Choose a reason for hiding this comment

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

SGTM!

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 16, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 16, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestFeb 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestMay 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestMay 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull requestMay 21, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@PiinksPiinksPiinks approved these changes

@chunhtaichunhtaichunhtai approved these changes

@nate-thegratenate-thegrateAwaiting requested review from nate-thegrate

Assignees

No one assigned

Labels

c: tech-debtTechnical debt, code quality, testing, etc.f: routesNavigator, Router, and related APIs.frameworkflutter/packages/flutter repository. See also f: labels.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@EArminjon@Piinks@chunhtai@nate-thegrate

Comments


[8]ページ先頭

©2009-2026 Movatter.jp