You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Troubleshooting: Dualis session persistence and refresh
17
+
18
+
## Problem
19
+
Dualis only stayed usable for the current in-memory session. After reopening the app, the page returned to the login form even when credentials were already stored. The logged-in views also lacked a manual refresh affordance.
20
+
21
+
## Root Cause
22
+
The Dualis view model supported explicit login only. It never attempted to restore a stored session when the page became visible again, and it had no persisted freshness timestamp to decide when stale data should be reloaded automatically.
23
+
24
+
## Solution
25
+
- Updated `StudyGradesViewModel` to:
26
+
- start in an initializing state so Dualis does not render the logged-out UI before the first saved-credential check completes
27
+
- restore the Dualis session from saved credentials when the Dualis section becomes visible
28
+
- refresh stale Dualis data automatically when reopening the section after a long gap
29
+
- expose `refreshData(force: true)` so the UI can trigger a full cache-busting reload
30
+
- track the last successful Dualis refresh in preferences
31
+
- Updated `DualisPage` to:
32
+
- observe section visibility inside the main `IndexedStack`
33
+
- trigger the stale-session refresh flow on first show and on app resume while Dualis is active
34
+
- show a loading state while the session is being restored
35
+
- Added pull-to-refresh to:
36
+
-`StudyOverviewPage`
37
+
-`ExamResultsPage`
38
+
- Extended the Dualis service contract with `clearCache()` so forced refreshes bypass cached grade/module data.
39
+
40
+
## Test Coverage
41
+
-`login falls back to LoginFailed on unexpected service errors`
42
+
-`loadAllModules keeps loading=true for the newest in-flight request`
43
+
-`restores the Dualis session from saved credentials on page open`
44
+
-`does not show login page before restoring saved session`
45
+
-`refreshData(force: true) clears cached Dualis data before reloading`
46
+
- existing Dualis loading animation widget tests
47
+
48
+
## Commands run
49
+
```bash
50
+
flutter test test/dualis/ui/viewmodels/study_grades_view_model_test.dart test/dualis/ui/study_overview_loading_animation_test.dart test/dualis/ui/dualis_page_session_restore_test.dart
0 commit comments