Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
This PR refactors list-member related presenters/handlers to improve list-member behavior and updates profile action-menu construction to be flow-driven.
Changes:
- Refactor
ProfilePresenteraction menu generation into a combined flow (profileMenusFlow) and extractbuildProfileMenus(...). - Refactor
ListMembersPresenter/EditListMemberPresenterto use lazily-initialized flows (and aMutableStateFlowfilter) instead of rebuilding flows inrememberblocks. - Update
ListMemberHandlerpaging/member mutation logic (typedFlow<PagingData<UiProfile>>, transactional writes, optimistic DB updates with rollback on failure).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
shared/src/commonMain/kotlin/dev/dimension/flare/ui/presenter/profile/ProfilePresenter.kt |
Moves profile action menu building to a combined flow and extracts menu builder function. |
shared/src/commonMain/kotlin/dev/dimension/flare/ui/presenter/list/ListMembersPresenter.kt |
Extracts members paging flow into a lazy property and simplifies Compose body. |
shared/src/commonMain/kotlin/dev/dimension/flare/ui/presenter/list/EditListMemberPresenter.kt |
Replaces Compose state filter with MutableStateFlow and combines flows to drive user search paging. |
shared/src/commonMain/kotlin/dev/dimension/flare/data/datasource/microblog/handler/ListMemberHandler.kt |
Adjusts list-members paging API and adds optimistic DB updates for add/remove member. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| database.connect { | ||
| if (request == PagingRequest.Refresh) { | ||
| database.listDao().deleteMembersByListKey(listKey) | ||
| } | ||
| database.listDao().insertAllMember( | ||
| data.map { item -> | ||
| DbListMember( | ||
| listKey = listKey, | ||
| memberKey = item.key, | ||
| ) | ||
| }, | ||
| ) | ||
| database.upsertUsers(data.map { it.toDbUser() }) | ||
| } |
There was a problem hiding this comment.
createPagingRemoteMediator already wraps onSave inside database.connect { ... } (see BasePagingRemoteMediator.doLoad). Calling database.connect again here creates a nested writer transaction/connection, which is unnecessary and can cause issues depending on the Room driver. Consider removing the inner database.connect {} and performing the DAO writes directly in onSave.
No description provided.