Repository navigation
fix(mind-map) clear stale error state on successful background reload - #8285
Conversation
When the app resumes from background, _loadGraph(silent: true) was skipping all setState calls even on success, leaving _error set permanently after an initial network failure. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
hitNodeId is already guarded by a null check above, so the ! operator has no effect and triggers a lint warning. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
The field is never reassigned, only mutated via clear/add, so it can be declared final. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Both are compile-time constants; using const avoids unnecessary runtime allocation. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
There was a problem hiding this comment.
1 issue found across 1 file
Confidence score: 3/5
- In
app/lib/pages/memories/widgets/memory_graph_page.dart, the_isSameGraphearly return can skip the new error-clearingsetState, so a successful silent reload may still show a stale_errorbanner and mislead users into thinking the graph is still failing — clear_errorbefore the early return (or in a path that always runs) and add a regression test for same-data successful reloads before merging.
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
|
|
||
| _populateGraph(data); | ||
| _runLayoutSync(); | ||
| if (_error != null && mounted) { |
There was a problem hiding this comment.
P2: Successful silent reloads still leave stale _error when graph data is unchanged because _isSameGraph returns before the new error-clearing setState block.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/lib/pages/memories/widgets/memory_graph_page.dart, line 341:
<comment>Successful silent reloads still leave stale `_error` when graph data is unchanged because `_isSameGraph` returns before the new error-clearing `setState` block.</comment>
<file context>
@@ -338,6 +338,11 @@ class _MemoryGraphPageState extends State<MemoryGraphPage> with SingleTickerProv
_populateGraph(data);
_runLayoutSync();
+ if (_error != null && mounted) {
+ setState(() {
+ _error = null;
</file context>
✅ Addressed in 7aa6e27
The error-clearing setState was placed after _isSameGraph, so a silent reload that succeeded but found unchanged data (common for empty graphs) would still leave _error set and show the stale error banner indefinitely. Move the clear to before the early return so every successful API response clears the error, regardless of whether the graph changed. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
There was a problem hiding this comment.
No issues found across 1 file
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Tip: cubic could auto-approve low-risk PRs like this, if it thinks it's safe to merge. Learn more
Re-trigger cubic
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks @krushnarout — this looks good to me.
The change cleanly fixes the stale Mind Map error state by clearing _error after a successful background reload, including the same-graph early-return path. The additional Dart cleanup is small and safe, and CI is green.
Summary
silent: truereload path never calledsetState, so_errorwas never cleared after a successful load.!null assertion, addfinalto a never-reassigned field, and useconstfor compile-time constants in the share-graph path.Commits
fix(mind-map): clear_errorwhen silent reload succeedsrefactor(mind-map): remove unnecessary!onhitNodeIdrefactor(mind-map): make_highlightedNodeIdsfinalrefactor(mind-map): preferconstfortextSpanandyPosTest plan
🤖 Generated with Claude Code