From c1df2af9920df5e1c6e48746a916fd0eb53c3a5c Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Mon, 11 May 2026 17:32:57 -0400 Subject: [PATCH] =?UTF-8?q?fix(flutter):=20/queue=20at=20top=20level=20?= =?UTF-8?q?=E2=80=94=20fixes=20duplicate-key=20crash=20from=20player?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tapping the queue button from /now-playing crashed with NavigatorState._debugCheckDuplicatedPageKeys. Root cause: when I moved /now-playing out of the ShellRoute earlier, /queue was left inside the shell. Pushing /queue while /now-playing was on top made go_router try to mount a second ShellRoute instance under the existing one — both shells got the same page key. Move /queue out of the ShellRoute too, sibling to /now-playing. Shell stays mounted (with whatever child it had) underneath both top-level routes; pop from /queue returns to /now-playing or the shell's previous child as appropriate. --- flutter_client/lib/shared/routing.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/flutter_client/lib/shared/routing.dart b/flutter_client/lib/shared/routing.dart index 532cf1e3..73c3eac5 100644 --- a/flutter_client/lib/shared/routing.dart +++ b/flutter_client/lib/shared/routing.dart @@ -85,6 +85,14 @@ GoRouter buildRouter(Ref ref) { }, ), ), + // /queue lives outside the ShellRoute too. Why: pushing /queue + // from /now-playing (which is also outside the shell) used to + // cause go_router to mount a second ShellRoute instance under + // the existing one, producing a duplicate page-key assertion + // (NavigatorState._debugCheckDuplicatedPageKeys). Top-level + // routes can stack on each other freely; shell-children can't + // when something on top of the shell is already routing. + GoRoute(path: '/queue', builder: (_, __) => const QueueScreen()), ShellRoute( builder: (ctx, state, child) => VersionGate(child: _ShellWithPlayerBar(child: child)), routes: [ @@ -105,7 +113,6 @@ GoRouter buildRouter(Ref ref) { seed: s.extra is AlbumRef ? s.extra as AlbumRef : null, ), ), - GoRoute(path: '/queue', builder: (_, __) => const QueueScreen()), GoRoute(path: '/search', builder: (_, __) => const SearchScreen()), GoRoute(path: '/library', builder: (_, __) => const LibraryScreen()), GoRoute(path: '/discover', builder: (_, __) => const DiscoverScreen()),