Skip to content

Omi task indentation persistence#4698

Draft
kodjima33 wants to merge 1 commit intomainfrom
cursor-agent-1770662232
Draft

Omi task indentation persistence#4698
kodjima33 wants to merge 1 commit intomainfrom
cursor-agent-1770662232

Conversation

@kodjima33
Copy link
Collaborator

Fix task indentation persistence in the action items list.

This PR ensures that when a user indents or dedents a task, its hierarchical state is saved to persistent storage and correctly restored upon app restart.


Open in Cursor Open in Web

- Add taskIndentLevels storage methods to SharedPreferencesUtil
- Load indent levels from SharedPreferences on ActionItemsPage init
- Save indent levels when incrementing or decrementing indentation
- Ensures task hierarchy/nesting survives app restart

Co-authored-by: Nik Shevchenko <[email protected]>
@cursor
Copy link

cursor bot commented Feb 9, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully implements persistence for task indentation levels. The changes are well-contained and follow existing patterns for using SharedPreferences. I've identified two areas for improvement: one is to add logging for deserialization errors to aid in debugging, and the other is to implement a mechanism for cleaning up stale indentation data for deleted tasks to prevent storage bloat and memory leaks. Overall, a good addition to persist UI state.

Comment on lines +238 to +240
} catch (e) {
return {};
}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The catch block silently fails and returns an empty map. While this prevents the app from crashing, it hides potential issues with data serialization or corruption. It would be beneficial to log the error, similar to how it's done in the customSttConfig getter in this same file. This helps with debugging if users report issues with their settings not being persisted correctly.

    } catch (e) {
      Logger.debug('Error parsing taskIndentLevels: $e');
      return {};
    }

Comment on lines +105 to +112
void _loadIndentLevels() {
final savedLevels = SharedPreferencesUtil().taskIndentLevels;
setState(() {
_indentLevels
..clear()
..addAll(savedLevels);
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The current implementation for persisting indent levels does not account for task deletion. When a task is deleted, its indent level remains in SharedPreferences, leading to accumulation of stale data over time. This causes storage bloat and a minor memory leak in the _indentLevels map.

A pruning mechanism should be implemented to remove indent levels for tasks that no longer exist. This could be done when tasks are deleted (e.g., in _deleteTask), or periodically by comparing the keys in _indentLevels with the current task IDs after they are fetched. A similar cleanup pattern is used in _pruneTaskGoalLinks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants