Skip to content

[go_router] push future does not complete if popping shellroute #147196

@chunhtai

Description

@chunhtai

This is blocking internal package roll
https://critique.corp.google.com/cl/626191458

Steps to reproduce

This test should pass

    testWidgets('can complete leaf route', (WidgetTester tester) async {
      Future<bool?>? routeFuture;
      final List<RouteBase> routes = <RouteBase>[
        GoRoute(
          path: '/',
          builder: (BuildContext context, GoRouterState state) {
            return Scaffold(
              body: TextButton(
                onPressed: () async {
                  routeFuture = context.push<bool>('/a');
                },
                child: const Text('press'),
              ),
            );
          },
        ),
        ShellRoute(
          builder: (BuildContext context, GoRouterState state, Widget child) {
            return Scaffold(
              body: child,
            );
          },
          routes: <RouteBase>[
            GoRoute(
              path: '/a',
              builder: (BuildContext context, GoRouterState state) {
                return const Scaffold(
                  body: Text('Screen A'),
                );
              },
            ),
          ],
        ),
      ];

      final GoRouter router = await createRouter(routes, tester);
      expect(find.text('press'), findsOneWidget);

      await tester.tap(find.text('press'));
      await tester.pumpAndSettle();
      expect(find.text('Screen A'), findsOneWidget);

      router.pop<bool>(true);
      final bool? result = await routeFuture;
      expect(result, isTrue);
    });

Expected results

test pass

Actual results

test hangs

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listc: regressionIt was better in the past than it is now

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions