File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -185,10 +185,24 @@ class FestivalSelectorSheet extends StatelessWidget {
185185 sortedFestivals: festivals,
186186 isSelected: isSelected,
187187 onTap: () {
188+ // Capture current path first, before any state changes
189+ // Default to festival home; override if currently on favorites
190+ String targetPath = buildFestivalHome (festival.id);
191+ try {
192+ final currentPath = GoRouterState .of (context).uri.path;
193+ // Preserve user's tab: if on favorites, stay on favorites
194+ if (currentPath.endsWith ('/favorites' )) {
195+ targetPath = buildFavoritesPath (festival.id);
196+ }
197+ } catch (e) {
198+ // GoRouterState unavailable (e.g., in tests), keep default path
199+ debugPrint ('Festival selector: Unable to get current route, using default: $e ' );
200+ }
201+
188202 final router = GoRouter .maybeOf (context);
189203 provider.setFestival (festival);
190204 Navigator .pop (context);
191- router? .go ('/${ festival . id }' );
205+ router? .go (targetPath );
192206 },
193207 onInfoTap: () {
194208 Navigator .pop (context);
You can’t perform that action at this time.
0 commit comments