Skip to content

Refactor chat list state decomposition into focused StateFlows#242

Merged
gdlbo merged 1 commit intomonogram-android:developfrom
fakelog:chat-list-state-decomposition
Apr 12, 2026
Merged

Refactor chat list state decomposition into focused StateFlows#242
gdlbo merged 1 commit intomonogram-android:developfrom
fakelog:chat-list-state-decomposition

Conversation

@fakelog
Copy link
Copy Markdown
Contributor

@fakelog fakelog commented Apr 12, 2026

Previously, a single broad state object caused unnecessary recompositions of the entire ChatListContent screen on unrelated changes (connectionStatus, updateState, activeChatId, search, proxy, selection).

Now state is split by responsibility:

  • uiState: chrome, overlays, navigation flags
  • foldersState: folders, selected folder, loading, scroll position
  • chatsState: active chat list
  • searchState: search queries and results
  • selectionState: selection and active chat

Benefits:

  • Unrelated updates no longer recompose the whole chat list
  • Chat list subscribes to a narrower flow, reducing noise
  • State model aligns better with actual screen use-cases, improving maintainability
  • Removed redundant ChatListStore intermediate layer

Additionally, added a fast path in the repository for point updates by chatId to avoid rebuilding the entire list on individual item changes.

Previously, a single broad state object caused unnecessary recompositions of the entire ChatListContent screen on unrelated changes (connectionStatus, updateState, activeChatId, search, proxy, selection).

Now state is split by responsibility:
- uiState: chrome, overlays, navigation flags
- foldersState: folders, selected folder, loading, scroll position
- chatsState: active chat list
- searchState: search queries and results
- selectionState: selection and active chat

Benefits:
- Unrelated updates no longer recompose the whole chat list
- Chat list subscribes to a narrower flow, reducing noise
- State model aligns better with actual screen use-cases, improving maintainability
- Removed redundant ChatListStore intermediate layer

Additionally, added a fast path in the repository for point updates by chatId to avoid rebuilding the entire list on individual item changes.
@gdlbo gdlbo merged commit 9c21d3b into monogram-android:develop Apr 12, 2026
1 check passed
@fakelog fakelog deleted the chat-list-state-decomposition branch April 15, 2026 10:31
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