Fix: New expense not visible in grouped-by from search when created offline#92132
Draft
aswin-s wants to merge 2 commits into
Draft
Fix: New expense not visible in grouped-by from search when created offline#92132aswin-s wants to merge 2 commits into
aswin-s wants to merge 2 commits into
Conversation
…ting expense offline When the search view has groupBy:from active, creating an expense offline did not write a group_<fromAccountID> entry into optimisticSnapshotData. getMemberSections renders exclusively from group_-prefixed Onyx keys, so the new expense was invisible until the next online sync.
The initial fix always computed count:1 and total:transaction.amount because optimisticSnapshotData is a fresh object per call. Subscribe to the SNAPSHOT collection at module level so the existing group_ entry can be read and its count/total incremented correctly. Also preserve the existing group's currency rather than overwriting it.
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.
Explanation of Change
When the Search view has Group by: From active and the user creates a new expense while offline, the expense was invisible in the grouped list — only appearing after the next online sync.
Root cause:
getSearchOnyxUpdateinsrc/libs/actions/IOU/SearchUpdate.tsalready handled thegroupBy === FROMcase by pushing a snapshot update for the drill-down (per-member) query, but it never wrote agroup_<fromAccountID>entry intooptimisticSnapshotDatafor the parent grouped view.getMemberSectionsinSearchUIUtils.tsrenders exclusively fromgroup_-prefixed Onyx keys viaisGroupEntry, so with no such key written, the new expense simply had no row to appear in.Fix:
groupBy === FROMbranch, write agroup_<fromAccountID>entry tooptimisticSnapshotDatashaped asSearchMemberGroup({ accountID, count, total, currency }).ONYXKEYS.COLLECTION.SNAPSHOTat module level (same pattern used by other IOU action modules) so the existing group'scount,total, andcurrencyare read from live Onyx state and correctly incremented rather than reset to the single new transaction's values.Fixed Issues
$ #91453
PROPOSAL: #91453 (comment)
Tests
count + 1andtotal + 100, orOffline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)Screenshots/Videos
Web