Skip to content

Commit e915910

Browse files
committed
fix(router): use pushNamed instead of goNamed for navigation
- Replace goNamed with pushNamed to preserve navigation stack - Ensures correct context and ancestor widgets when launching from terminated state - Maintains proper feed structure when navigating to article details
1 parent 120acb0 commit e915910

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/app/view/app.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,13 @@ class _AppViewState extends State<_AppView> {
219219
final id = payload.data['headlineId'] as String?;
220220

221221
if (contentType == 'headline' && id != null) {
222-
_router.goNamed(
222+
// Use pushNamed instead of goNamed.
223+
// goNamed replaces the entire navigation stack, which causes issues
224+
// when the app is launched from a terminated state. The new page
225+
// would lack the necessary ancestor widgets (like RepositoryProviders).
226+
// pushNamed correctly pushes the details page on top of the
227+
// existing stack (e.g., the feed), ensuring a valid context.
228+
_router.pushNamed(
223229
Routes.globalArticleDetailsName,
224230
pathParameters: {'id': id},
225231
);

0 commit comments

Comments
 (0)