Stop highlighting old transaction, when cache was cleared#64073
Conversation
Kicu
left a comment
There was a problem hiding this comment.
Looks decent, taking into the account problems with other solutions.
It is not idea to base this solution on time passed since initial render, though I understand why you did it.
I think if we stay with this solution, you should write (here on github) a few lines describing why it is difficult in onyx to differentiate between first and subsequent loadings of transactions.
Such a description would allow for other developers to get involved and possibly help.
| const {reportActions: unfilteredReportActions, hasNewerActions, hasOlderActions} = usePaginatedReportActions(reportID); | ||
| const reportActions = getFilteredReportActionsForReportView(unfilteredReportActions); | ||
|
|
||
| // ref used to not compute new transaction on the first full load to avoid highlighting transactions that belonged to the report but weren't present in Onyx |
There was a problem hiding this comment.
rephrase ref used to not compute (...)
…-when-cache-was-cleared
|
@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] |
| function selectAllTransactionsForReport(transactions: OnyxCollection<Transaction>, reportID: string | undefined, reportActions: ReportAction[]) { | ||
| if (!reportID) { | ||
| return []; | ||
| return undefined; |
There was a problem hiding this comment.
Is there any reason why we need to return undefined here?
There was a problem hiding this comment.
If the transaction is empty array we also return empty string in useNewTransactions
There was a problem hiding this comment.
I was experimenting with it as a way to indicate loading state and forgot to roll it back. It's done now.
|
@SzymczakJ The others looks fine |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-06-17.at.15.22.07.movAndroid: mWeb ChromeScreen.Recording.2025-06-17.at.15.21.02.moviOS: HybridAppScreen.Recording.2025-06-17.at.15.19.56.moviOS: mWeb SafariScreen.Recording.2025-06-17.at.15.18.35.movMacOS: Chrome / SafariScreen.Recording.2025-06-17.at.14.52.05.movMacOS: DesktopScreen.Recording.2025-06-17.at.14.58.20.mov |
|
@SzymczakJ on Monday, can you please add tests for the hook? I feel like we should capture its logic with tests but dont want to hold the PR for it as you are ooo the rest of the week. Thanks! |
|
✋ 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/mountiny in version: 9.1.69-0 🚀
|
1 similar comment
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.1.69-0 🚀
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.1.69-0 🚀
|
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.1.69-3 🚀
|
|
@SzymczakJ did you add these tests? #64073 (comment) |
|
Here's an open PR for it #64938 approved) |
|
Excellent, thanks! |
Explanation of Change
This PR adds
useNewTransactionshook that computes new transaction in the table report view(this logic was implemented before inMoneyRequestReportViewandReportScreen) and adds logic to skip first computation of new transactions on first report load. We do that to avoid the highlighting of reports that were present in the report, but weren't saved to onyx(becasue, for example cache was cleared).Fixed Issues
$ #63734
PROPOSAL:
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))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
Screen.Recording.2025-06-16.at.13.50.07.mov
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2025-06-16.at.13.45.44.mov
MacOS: Desktop