fix(flutter): /queue at top level — fixes duplicate-key crash from player
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.
This commit is contained in:
@@ -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(
|
ShellRoute(
|
||||||
builder: (ctx, state, child) => VersionGate(child: _ShellWithPlayerBar(child: child)),
|
builder: (ctx, state, child) => VersionGate(child: _ShellWithPlayerBar(child: child)),
|
||||||
routes: [
|
routes: [
|
||||||
@@ -105,7 +113,6 @@ GoRouter buildRouter(Ref ref) {
|
|||||||
seed: s.extra is AlbumRef ? s.extra as AlbumRef : null,
|
seed: s.extra is AlbumRef ? s.extra as AlbumRef : null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
GoRoute(path: '/queue', builder: (_, __) => const QueueScreen()),
|
|
||||||
GoRoute(path: '/search', builder: (_, __) => const SearchScreen()),
|
GoRoute(path: '/search', builder: (_, __) => const SearchScreen()),
|
||||||
GoRoute(path: '/library', builder: (_, __) => const LibraryScreen()),
|
GoRoute(path: '/library', builder: (_, __) => const LibraryScreen()),
|
||||||
GoRoute(path: '/discover', builder: (_, __) => const DiscoverScreen()),
|
GoRoute(path: '/discover', builder: (_, __) => const DiscoverScreen()),
|
||||||
|
|||||||
Reference in New Issue
Block a user