Refactor current chat state decomposition into focused StateFlows#256
Closed
fakelog wants to merge 1 commit intomonogram-android:developfrom
Closed
Refactor current chat state decomposition into focused StateFlows#256fakelog wants to merge 1 commit intomonogram-android:developfrom
fakelog wants to merge 1 commit intomonogram-android:developfrom
Conversation
Previously, a single broad state object caused unnecessary recompositions of the entire ChatContent screen on unrelated changes (input, search, selection, pinned state, viewers, overlays, appearance flags). Now state is split by responsibility: - chatUiState: top bar, screen-level flags, dialogs, topic/navigation state - messagesState: message list, loading, pagination, scroll commands and viewport state - selectionState: selected messages and selection mode - searchState: search query and search mode - inputState: draft, reply/edit state, bot commands, inline results, sticker sheet - pinnedState: pinned banner and pinned messages sheet - mediaViewerState: image/video/web/mini app viewers - appearanceState: wallpaper and message rendering preferences Benefits: - Unrelated updates no longer recompose the whole chat screen - Heavy UI like the message list subscribes to narrower flows, reducing noise - Screen state aligns better with actual UI responsibilities, improving maintainability - Background, message list and message options no longer depend on the monolithic state directly Additionally, moved ChatContent subtrees to the focused state models so the UI no longer collects the broad component state at the root.
261ff61 to
cf8343d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, a single broad state object caused unnecessary recompositions of the entire ChatContent screen on unrelated changes (input, search, selection, pinned state, viewers, overlays, appearance flags).
Now state is split by responsibility:
Benefits:
Additionally, moved ChatContent subtrees to the focused state models so the UI no longer collects the broad component state at the root.