Repository navigation
Add optimistic metadata updates when deleting expenses from search - #74637
Conversation
|
@DylanDylann Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Good improvement from a product perspective 👍
| * This allows us to read the current state synchronously when performing optimistic updates. | ||
| */ | ||
| let searchSnapshots: OnyxCollection<SearchResults> = {}; | ||
| Onyx.connect({ |
There was a problem hiding this comment.
@cosmicvulpes DOn't use the connect method anymore. Please pass Onyx value from UI
|
The rest looks fine |
|
@cosmicvulpes Please ping me when you update the above comment |
|
@DylanDylann I've resolved your comment. Please take a look. Thanks! |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-11-12.at.15.06.37.movAndroid: mWeb ChromeScreen.Recording.2025-11-12.at.15.03.04.moviOS: HybridAppScreen.Recording.2025-11-12.at.15.05.17.moviOS: mWeb SafariScreen.Recording.2025-11-12.at.15.01.20.movMacOS: Chrome / SafariScreen.Recording.2025-11-12.at.14.56.24.movMacOS: DesktopScreen.Recording.2025-11-12.at.14.59.10.mov |
|
@cosmicvulpes Please merge the latest main again |
- Cache search snapshots at module level for synchronous access - Update count and total optimistically in deleteMoneyRequestOnSearch - Preserve all metadata properties with spread operator - Handle negative expense amounts correctly when calculating deleted total
…equestOnSearch Remove module-level Onyx.connect() cache and update deleteMoneyRequestOnSearch() to accept currentSearchResults parameter passed from SearchPage component.
|
|
84d2ee2 to
5cf64f8
Compare
|
@DylanDylann rebased on main. |
|
@cosmicvulpes please dont force push, it makes it hard to follow changes:
|
Co-authored-by: Jack Senyitko <49812749+JS00001@users.noreply.github.com>
|
@JS00001 resolved your comment. Thanks! |
|
@cosmicvulpes I'm going to merge this because @DylanDylann added screen recordings, but in the future, please remember to add videos of the functionality on all platforms. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/JS00001 in version: 9.2.58-0 🚀
|
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.2.58-3 🚀
|
Explanation of Change
This PR adds optimistic updates for search metadata (count and total) when deleting expenses from search results. Previously, the footer displayed stale server data after deleting expenses, showing incorrect expense counts and totals until the server response arrived.
Implementation:
Onyx.connect()to synchronously access current search resultsdeleteMoneyRequestOnSearchto optimistically update search metadata:countby the number of deleted transactions (with safeguard to prevent negative values)totalby the sum of deleted transaction amountsFixed Issues
$ #69798
PROPOSAL: #69798 (comment)
Tests
Offline tests
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2025-11-08.at.5.44.46.PM.mp4
MacOS: Desktop