Skip to content

v1.0.1 - Fix SignalEffectException with Hidden Routes

Choose a tag to compare

@pillowsoft pillowsoft released this 03 Oct 22:53
· 50 commits to main since this release

πŸ› Bug Fix Release - v1.0.1

Fixed crash when using programmatic-only navigation (all routes with showInNavigation: false).

Bug Fixed

SignalEffectException when all routes have showInNavigation: false

Root Cause

  • Bottom navigation bar, sidebar, and navigation rail were being created even when visibleRoutes was empty (all routes hidden)
  • This caused SignalEffectException in WatchBuilder when trying to compute selected index with 0 navigation items
  • Apps using fully programmatic navigation could not run

Symptom

SignalEffectException in WatchBuilder
Log: visibleRoutes=0, useBottomNav=true ← Bug!

Solution

Added visibleRoutes.isNotEmpty safety checks before creating navigation widgets:

  • Line 89: Bottom navigation bar creation
  • Line 106: Sidebar creation
  • Line 116: Navigation rail creation

Impact

  • βœ… Apps with all routes hidden now work correctly
  • βœ… Programmatic-only navigation pattern is now supported
  • βœ… No navigation UI shown when visibleRoutes is empty
  • βœ… No crashes when using task-driven navigation patterns

Use Case

Perfect for apps with task-driven UIs that use only programmatic navigation via buttons and actions without persistent tabs, drawers, or sidebars:

AppRoute(
  title: 'Home',
  path: '/home',
  icon: CupertinoIcons.home,
  builder: (context, state) => const HomeScreen(),
  showInNavigation: false,  // βœ… Now works without crashing!
),
AppRoute(
  title: 'Settings',
  path: '/settings',
  icon: CupertinoIcons.settings,
  builder: (context, state) => const SettingsScreen(),
  showInNavigation: false,  // βœ… Now works without crashing!
),

Navigate programmatically:

// In your widgets
ElevatedButton(
  onPressed: () => context.go('/settings'),
  child: Text('Go to Settings'),
)

Full Changelog: https://github.com/pillowsoft/flutter_ps_app_shell/blob/main/packages/flutter_app_shell/CHANGELOG.md