-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Tapping Sign Out in the settings drawer crashes the app because the widget tree navigates to the auth screen while the drawer is still mounted. The sign-out handler calls AuthService.instance.signOut() which triggers auth state changes that tear down the widget tree, but the drawer's callback continues executing and hits context.mounted on a disposed context. This blocks automated E2E testing of the logout→login flow — agents must force-stop and relaunch after every sign-out (~30s overhead per test run).
Current Behavior
- User taps Sign Out → confirms with Ok
Navigator.of(ctx).pop()dismisses the confirmation dialog but NOT the drawerAuthService.instance.signOut()fires, auth state listener navigates to auth screen- Drawer widget is disposed mid-callback,
context.mountedcheck fails or crashes
Expected Behavior
Sign-out should dismiss the drawer first, then clear auth state and navigate cleanly to the auth screen without crash or freeze.
Affected Areas
| File | Line | Description |
|---|---|---|
app/lib/pages/settings/settings_drawer.dart |
564-570 | First sign-out handler: pops dialog but not drawer before signOut |
app/lib/pages/settings/settings_drawer.dart |
629-635 | Second sign-out handler: same pattern |
Solution
Dismiss the drawer (e.g., Navigator.of(context).pop()) before calling AuthService.instance.signOut(), or wrap the post-signOut navigation in a mounted guard that accounts for the drawer being disposed.
Files to Modify
app/lib/pages/settings/settings_drawer.dart
Impact
Low risk — only affects the sign-out flow. No impact on recording, transcription, or data paths.
by AI for @beastoin