Fix - Reports - New expense is not briefly highlighted in the list after expense is submitted#64111
Fix - Reports - New expense is not briefly highlighted in the list after expense is submitted#64111FitseTLT wants to merge 33 commits into
Conversation
|
@QichenZhu 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] |
| // Perform the scrolling action | ||
| ref.scrollToIndex(indexOfNewItem); | ||
| if (indexOfNewItem === data.length - 1) { | ||
| // Scrolling to last item needs a delay to work due to FlatList internal bug. |
There was a problem hiding this comment.
Is there a chance this is caused by the reason in #61278 (comment)? If so, it's probably not a FlatList bug since we're not using it the recommended way. But if it turns out to be an upstream bug, let's add an issue link so we can remove this workaround once it's fixed upstream.
There was a problem hiding this comment.
May be but I don't see the log warning in my console.
There was a problem hiding this comment.
The warning was suppressed by #61392.
App/src/components/Search/SearchList.tsx
Line 86 in 02e37d7
There was a problem hiding this comment.
Yeah exactly @QichenZhu I proved that onScrollToIndexFailed is called in this case. So do you suggest another method that delaying the call?
There was a problem hiding this comment.
I don't think we're on the right track to fix this. The codebase has changed a lot since your proposal, so we might need to dig deeper into the root cause and try a different solution. Please let me know if you're still interested. Thanks!
There was a problem hiding this comment.
@QichenZhu It is now working for that specific case it was failing (where the item is added to the end of the list) without any workaround delay. Can you check it ?
2025-07-16.17-47-43.mp4
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid-native.webmAndroid: mWeb Chromeandroid-web.webmiOS: HybridAppios-native.moviOS: mWeb Safariios-web.movMacOS: Chrome / Safarihighlight-old-expenses.movMacOS: Desktopmac-desktop.mov |
|
@QichenZhu Whats the issue? I'm having trouble following the thread |
|
@JS00001, this PR works better than the main branch, except for the three issues listed in my previous comments:
and #64111 (comment):
I think we've hit the limits of this path, and this might be the best outcome we can achieve with it. I'm not sure whether it meets the repo standard and we should proceed and merge it. |
Yes, it is intentional. This is the code that is preventing it App/src/hooks/useSearchHighlightAndScroll.ts Lines 88 to 91 in f6a223b
Added
Yeah this is a bit out of scope and the first time I tried to solve this problem I tried to use the transaction |
Yes that is expected
Looks like this was added
I dont think we should merge this with this issue existing. Let me look into the issue a bit more |
|
@FitseTLT Can you explain the issue a bit more and why other expenses are getting highlighted? |
Yeah @JS00001 This is because 2025-09-24.20-04-46.mp4The other inconsistent bug I am facing is regarding the documentation says positive value will push it down to the view port but from my testing positive value is pushing it out of view and negative value causing the vice versa. I did change the value to negative on a previous commit but after some time when merging main the switched back. So I have switched to using viewPosition:0 to put the item on top of the view I think this one is more safe and as the bug is internal flatlist one this is the best solution I suggest. Result:
Web: 2025-09-24.21-37-06.mp4Android: 2025-09-24.21-54-02.mp4 |
|
I think that looks good, @QichenZhu Could you please re-review? |
|
Not trying to nitpick, but I'm still seeing old expenses being highlighted. I don't think it's related to the highlighting logic. It seems more like an issue with virtual scrolling. Maybe we should live with it for now and ask an agency for help. highlight-old-expenses.mov |
I don't think this is a nitpick, and I dont think we should merge this as is. @trjExpensify Any thoughts on this? This PR is supposed to highlight new expenses, but its sometimes highlighting more than one expense, even ones that arent highlighted. I dont think the pros of merging this outweigh the cons |
|
Yeah, I agree with you. |
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.
|
This one has nothing to do with App/src/hooks/useAnimatedHighlightStyle/index.ts Lines 48 to 50 in 9490950 I think this is an advanced internal bug of the list component and I don't see how it is related to the scope of this PR. |
|
@FitseTLT Is this bug on prod right now? |
Nope On main the highlighting logic is broken so highlighting doesn't work for the new item too. |
|
Yeah I agree the bug could exist but isnt visible. However, I dont think we should be releasing 1 improvement alongside 1 added bug |
I understand your concern. Then, I think we should get someone from expert team for the last bug. |
|
@FitseTLT Can you please lay out the bug and the steps to repro it, and what you would need from them, so I can ask for their opinion on it? |
|
Test Steps:
Bug: you will see another old search item from bottom also gets highlighted briefly See. the video in #64111 (comment) Note: we have debugged that it has nothing to do with the App/src/hooks/useSearchHighlightAndScroll.ts Line 270 in 62f4869 we suspect some FlatList internal bug is causing it but we are not sure. 2025-10-10.23-33-23.mp4 |
|
sorry for the holdup, asked here: https://expensify.slack.com/archives/C08CZDJFJ77/p1761316978655769 |
Details
Fixed Issues
$ #59449
PROPOSAL: #59449 (comment)
Tests
Offline tests
Same as above
QA Steps
Same as above
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so 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
2025-06-13.20-28-09.mp4
Android: mWeb Chrome
2025-06-13.20-26-18.mp4
iOS: Native
2025-09-12.23-40-45.mp4
iOS: mWeb Safari
2025-06-13.20-22-49.mp4
MacOS: Chrome / Safari
2025-06-13.01-05-51.mp4
MacOS: Desktop
2025-06-13.20-21-46.mp4