Skip to content
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

When using Navigator 2.0 and a RouteAware widget with RouteObserver, the widget is rebuilt after its route is popped #116994

Open
dowski opened this issue Dec 13, 2022 · 4 comments
Labels
customer: google Various Google teams f: routes Navigator, Router, and related APIs. found in release: 3.3 Found to occur in 3.3 found in release: 3.7 Found to occur in 3.7 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list team-framework Owned by Framework team triaged-framework Triaged by Framework team

Comments

@dowski
Copy link

dowski commented Dec 13, 2022

Steps to Reproduce

  1. Open this DartPad
  2. Click "Run" on the upper right
  3. Click "Console" on the lower left to open the debug console
  4. When the UI appears, click each of "Open Navigator 2.0 Route" and "Open Navigator 1.0 Route"
  5. Click to pop each route
  6. Observe the different output in the debug console

Expected results:

When using a Navigator 2.0/Router route that launches a RouteAware widget, I don't expect it to be rebuilt after it is popped. It's different behavior than using a Navigator 1.0 route.

opening Navigator 2.0 Route
didChangeDependencies
build
did pop
dispose
---------------

Actual results:

The RouteAware widget shown via the Navigator 2.0 route gets rebuilt after it is popped.

opening Navigator 2.0 Route
didChangeDependencies
build
did pop
didChangeDependencies
build
dispose
---------------

If you uncheck the "Use route observer?" checkbox, it doesn't get rebuilt when the route is popped.

Code sample

See https://dartpad.dev/?id=9c70e9ccba24e889d8a190a74671bb42

Logs

N/A, repro in DartPad

@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Dec 14, 2022
@darshankawar
Copy link
Member

Thanks for the report. Seeing same behavior upon running the provided code sample:

flutter: opening Navigator 2.0 Route
flutter: didChangeDependencies
flutter: build
flutter: did pop
flutter: didChangeDependencies
flutter: build
flutter: dispose
flutter: ---------------
flutter: opening Navigator 1.0 Route
flutter: didChangeDependencies
flutter: build
flutter: did pop
flutter: dispose
flutter: ---------------

stable, master flutter doctor -v
[✓] Flutter (Channel stable, 3.3.9, on macOS 12.2.1 21D62 darwin-x64, locale
    en-GB)
    • Flutter version 3.3.9 on channel stable at
      /Users/dhs/documents/fluttersdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b8f7f1f986 (12 days ago), 2022-11-23 06:43:51 +0900
    • Engine revision 8f2221fbef
    • Dart version 2.18.5
    • DevTools version 2.15.0

[!] Xcode - develop for iOS and macOS (Xcode 12.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    ! Flutter recommends a minimum Xcode version of 13.
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] VS Code (version 1.62.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.21.0

[✓] Connected device (5 available)
    • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
    • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
      ios            • iOS 14.4.1 18D61
    • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
      ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    • macOS (desktop)            • macos                                    •
      darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
    • Chrome (web)               • chrome                                   •
      web-javascript • Google Chrome 98.0.4758.80

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

[!] Flutter (Channel master, 3.7.0-8.0.pre.5, on macOS 12.2.1 21D62 darwin-x64,
    locale en-GB)
    • Flutter version 3.7.0-8.0.pre.5 on channel master at
      /Users/dhs/documents/fluttersdk/flutter
    ! Warning: `flutter` on your path resolves to
      /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
      your current Flutter SDK checkout at
      /Users/dhs/documents/fluttersdk/flutter. Consider adding
      /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
    ! Warning: `dart` on your path resolves to
      /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
      current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
      Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
      of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f07db4018a (3 hours ago), 2022-12-14 03:25:49 +0200
    • Engine revision 14194c40ec
    • Dart version 3.0.0 (build 3.0.0-19.0.dev)
    • DevTools version 2.20.0
    • If those were intentional, you can disregard the above warnings; however
      it is recommended to use "git" directly to perform update checks and
      upgrades.


[!] Xcode - develop for iOS and macOS (Xcode 12.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    ! Flutter recommends a minimum Xcode version of 13.
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] VS Code (version 1.62.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.21.0

[✓] Connected device (5 available)
    • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
    • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
      ios            • iOS 14.4.1 18D61
    • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
      ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    • macOS (desktop)            • macos                                    •
      darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
    • Chrome (web)               • chrome                                   •
      web-javascript • Google Chrome 98.0.4758.80

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.



@darshankawar darshankawar added framework flutter/packages/flutter repository. See also f: labels. f: routes Navigator, Router, and related APIs. has reproducible steps The issue has been confirmed reproducible and is ready to work on found in release: 3.3 Found to occur in 3.3 found in release: 3.7 Found to occur in 3.7 and removed in triage Presently being triaged by the triage team labels Dec 14, 2022
@xster xster added customer: google Various Google teams P1 High-priority issues at the top of the work list labels Dec 16, 2022
@xster
Copy link
Member

xster commented Dec 16, 2022

P3 to match b/262398491

@tanlianghao
Copy link

Thanks for the report. Seeing same behavior upon running the provided code sample:

flutter: opening Navigator 2.0 Route
flutter: didChangeDependencies
flutter: build
flutter: did pop
flutter: didChangeDependencies
flutter: build
flutter: dispose
flutter: ---------------
flutter: opening Navigator 1.0 Route
flutter: didChangeDependencies
flutter: build
flutter: did pop
flutter: dispose
flutter: ---------------

stable, master flutter doctor -v

It will cause the non-top page to re-execute the build

@flutter-triage-bot flutter-triage-bot bot added team-framework Owned by Framework team triaged-framework Triaged by Framework team labels Jul 8, 2023
@flutter-triage-bot
Copy link

This issue is marked P1 but has had no recent status updates.

The P1 label indicates high-priority issues that are at the top of the work list. This is the highest priority level a bug can have if it isn't affecting a top-tier customer or breaking the build. Bugs marked P1 are generally actively being worked on unless the assignee is dealing with a P0 bug (or another P1 bug). Issues at this level should be resolved in a matter of months and should have monthly updates on GitHub.

Please consider where this bug really falls in our current priorities, and label it or assign it accordingly. This allows people to have a clearer picture of what work is actually planned. Thanks!

@flutter-triage-bot flutter-triage-bot bot removed the triaged-framework Triaged by Framework team label Sep 9, 2023
@goderbauer goderbauer added P2 Important issues not at the top of the work list triaged-framework Triaged by Framework team and removed P1 High-priority issues at the top of the work list labels Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer: google Various Google teams f: routes Navigator, Router, and related APIs. found in release: 3.3 Found to occur in 3.3 found in release: 3.7 Found to occur in 3.7 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list team-framework Owned by Framework team triaged-framework Triaged by Framework team
Projects
None yet
Development

No branches or pull requests

5 participants