Skip to content

Commit

Permalink
fix: Avoid recreating router on change font, theme or locale
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustl22 committed Jun 13, 2024
1 parent 020177d commit 79bd89b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion wrestling_scoreboard_client/lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class WrestlingScoreboardApp extends ConsumerStatefulWidget {
}

class WrestlingScoreboardAppState extends ConsumerState<WrestlingScoreboardApp> {
// Initialize router once to avoid reloading initial path on rebuild.
final routerConfig = getRouter();

@override
void initState() {
super.initState();
Expand Down Expand Up @@ -65,7 +68,7 @@ class WrestlingScoreboardAppState extends ConsumerState<WrestlingScoreboardApp>
supportedLocales: Preferences.supportedLanguages,
builder: (context, child) => GlobalWidget(child: child ?? const CircularProgressIndicator()),
locale: locale,
routerConfig: getRouter(),
routerConfig: routerConfig,
);
},
);
Expand Down

0 comments on commit 79bd89b

Please sign in to comment.