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

Using GoRouter with pageBuilder doesn't capture the destination ("to") page in the navigation breadcrumb #2014

Closed
Jonny1987 opened this issue Apr 25, 2024 · 5 comments
Assignees

Comments

@Jonny1987
Copy link

Platform

Dart

Obfuscation

Disabled

Debug Info

Disabled

Doctor

[✓] Flutter (Channel stable, 3.19.6, on Ubuntu 22.04.4 LTS 6.5.0-26-generic, locale en_US.UTF-8)
• Flutter version 3.19.6 on channel stable at /home/john/dev/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 54e66469a9 (8 days ago), 2024-04-17 13:08:03 -0700
• Engine revision c4cd48e186
• Dart version 3.3.4
• DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /home/john/Android/Sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /opt/android-studio/jbr/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
• All Android licenses accepted.

[✓] Chrome - develop for the web
• Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
• Ubuntu clang version 14.0.0-1ubuntu1.1
• cmake version 3.22.1
• ninja version 1.10.1
• pkg-config version 0.29.2

[✓] Android Studio (version 2023.1)
• Android Studio at /opt/android-studio
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] VS Code (version 1.88.1)
• VS Code at /usr/share/code
• Flutter extension version 3.86.0

[✓] Connected device (3 available)
• sdk gphone x86 64 (mobile) • emulator-5554 • android-x64 • Android 13 (API 33) (emulator)
• Linux (desktop) • linux • linux-x64 • Ubuntu 22.04.4 LTS 6.5.0-26-generic
• Chrome (web) • chrome • web-javascript • Google Chrome 123.0.6312.86

[✓] Network resources
• All expected network resources are available.

• No issues found!

Version

8.0.0

Steps to Reproduce

  1. Create a route for GoRouter which uses a pageBuilder.

eg:

GoRoute(
  path: 'venue-details/:venueId',
  name: AppRoute.venueDetails.name,
  pageBuilder: (context, state) {
    final venueId = int.parse(state.pathParameters['venueId']!);
    return MaterialPage(
      key: state.pageKey,
      fullscreenDialog: true,
      child: VenueDetailsPage(
        venueId: venueId,
      ),
    );
  },
),
  1. Trigger the route navigation

Expected Result

It should show the navigation breadcrumb with the "to" parameter like so (this is the actual result when changing the route to use pageBuilder instead:

{
  from: home,
  from_arguments: {
    venueId: 106
  },
  state: didPush,
  to: venueDetails,
  to_arguments: {
    venueId: 106
  }
}

Actual Result

{
  from: home,
  from_arguments: {
    venueId: 106
  },
  state: didPush
}

Are you willing to submit a PR?

None

@buenaflor
Copy link
Contributor

Hi has this been an issue with older versions as well?

@Jonny1987
Copy link
Author

I only have experience with the latest version

@buenaflor
Copy link
Contributor

buenaflor commented Apr 29, 2024

Got it, thanks for the issue, we'll take a look

@denrase
Copy link
Collaborator

denrase commented May 6, 2024

@Jonny1987 I got it to work when providing the SentryNavigatorObserver to the Go router instead of the MaterialApp. and I also used context.go("/go") for navigation.

final _router = GoRouter(
  routes: [
    GoRoute(
      path: '/',
      builder: (context, state) => const MainScaffold(),
    ),
    GoRoute(
      path: "/go",
      builder: (context, state) => SentryDisplayWidget(child: const AutoCloseScreen())
    )
  ],
  observers: [
    SentryNavigatorObserver()
  ]
);

...

void onPress(BuildContext context) {
  context.go("/go")
}

Then the methods of the navigator were called and I could see the breadcrumb.

Bildschirmfoto 2024-05-06 um 17 32 37

Could you check if this setup works for you?

@buenaflor
Copy link
Contributor

@Jonny1987 we have docs of usage with go router as well

feel free to comment if there's any other issue

@buenaflor buenaflor closed this as not planned Won't fix, can't repro, duplicate, stale May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Status: Done
Development

No branches or pull requests

3 participants