Skip to content

fix(app): keep a failed Mind Map resume refresh from showing an error toast - #22714

Merged
kodjima33 merged 1 commit into
BasedHardware:mainfrom
sauranshbhardwaj:fix/mind-map-quiet-resume-refresh
Oct 20, 2026
Merged

kodjima33 merged 1 commit into
BasedHardware:mainfrom
sauranshbhardwaj:fix/mind-map-quiet-resume-refresh

Conversation

@sauranshbhardwaj

@sauranshbhardwaj sauranshbhardwaj commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What's wrong

MemoryGraphPage reloads silently every time the app comes back to the foreground:

// app/lib/pages/memories/widgets/memory_graph_page.dart
void didChangeAppLifecycleState(AppLifecycleState state) {
  if (state == AppLifecycleState.resumed) {
    _loadGraph(silent: true);
  }
}

Before #22078 a failed silent load did nothing (if (!silent) setState(...)). The rewritten catch block dropped that guard, so a resume refresh that fails while a map is loaded now raises the toast:

} else if (_hasContent) {
  OmiFeedback.error(context, context.l10n.couldNotLoadKnowledgeGraph,
      actionLabel: context.l10n.tryAgain, onAction: () => _loadGraph(loadMore: loadMore));
}

The Memories tab stays alive in Home's IndexedStack once visited, and its Mind Map preview is a MemoryGraphPage. The toast goes to the root ScaffoldMessenger, so it shows on whatever tab is open, usually Home, which has no map on it. Coming back to the app while offline, or closing Control Center with airplane mode on, is enough.

refresh that fails while a map is loaded before after
on app resume (background) "Couldn't load knowledge graph · Try again" on the current tab map kept, no toast
Refresh tapped on the page toast toast

Change

Only show the toast for a refresh the person started. A silent refresh keeps the current map, as it did before #22078. The empty-map and session-changed branches are unchanged.

Tests

test/widgets/memory_graph_empty_state_test.dart: "a failed refresh on app resume keeps the map without a toast". It loads a map, resumes with a failing loader (no toast, map still shown; fails on main), then taps Refresh with the same failing loader (toast shown). The other 16 graph tests pass unchanged.

Product invariants affected

  • INV-MEM-1: path match only (app/lib/pages/memories/**). This changes when a Mind Map load failure is announced; memory tiers, collections and Archive access are untouched.

UI-Evidence: none -- removes a toast from a background refresh; the widget test pins both the silent and the user-started case.

Failure-Class: none

View guided diff

… toast

MemoryGraphPage reloads silently on every app resume. BasedHardware#22078 rewrote
its catch block and dropped the old `if (!silent)` guard, so a resume
refresh that fails while a map is loaded now shows "Couldn't load
knowledge graph · Try again". The Memories tab stays alive in Home's
IndexedStack, so the toast appears on whatever tab is open, usually
Home. Background refreshes now keep the current map quietly again; a
refresh the person starts still reports the failure.
@Git-on-my-level Git-on-my-level added positive-signal Automation verified a genuine fix/quality contribution flutter flutter work labels Oct 20, 2026
@Git-on-my-level

Copy link
Copy Markdown
Member

The fix is correct and tightly scoped — it restores the pre-#22078 quiet behavior for background refreshes, with a test covering both paths. No blocking issues.

Per file:

  • app/lib/pages/memories/widgets/memory_graph_page.dart — the new if (!silent) guard wraps only the OmiFeedback.error call in the _hasContent branch of the catch block (~lines 438–443). Verified that silent: true is passed solely from didChangeAppLifecycleState(resumed) (line 391), while every user-initiated path (the refresh buttons at lines 675/742/789 and the toast's own retry action) still passes silent: false, so explicit refreshes keep their toast. The session-changed, cursor-expired, and empty-map branches are untouched, exactly as the description claims.
  • app/test/widgets/memory_graph_empty_state_test.dart — the new test loads a map, simulates app resume with a failing loader, asserts no toast and the map retained, then taps Refresh with the same failing loader and asserts the toast appears. It reuses this file's established patterns (mind_map_refresh key, didChangeAppLifecycleState simulation, 9-second dismiss pump), so it tests the behavior rather than the implementation.
  • app/changelog/unreleased/20261020-mind-map-quiet-resume.json — schema ({"change": ...}) and filename convention match the existing unreleased fragments.

UX: one deliberate trade-off worth naming — after a failed silent resume refresh, the map stays stale until the next explicit refresh. That matches the pre-#22078 behavior and is the right call for a toast that would otherwise appear over unrelated tabs.

USER IMPACT: Returning to the app while offline no longer pops a "Couldn't load knowledge graph" toast over whatever tab you're on; the saved Mind Map stays as-is, and tapping Refresh still reports failures.

Nothing further needed from my side — the test coverage is appropriate for the change. Leaving the merge call to a maintainer.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scoped mobile bug fix (44 lines) restoring the silent-failure guard dropped in #22078, with repro table and test coverage; 5/5 confidence, CI green.

@kodjima33
kodjima33 merged commit ef8152f into BasedHardware:main Oct 20, 2026
47 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flutter flutter work positive-signal Automation verified a genuine fix/quality contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants