Search - Highlight newly added expense#49192
Conversation
|
@dubielzyk-expensify @ishpaul777 One of you needs to 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] |
src/components/Search/index.tsx
Outdated
| const searchTriggeredRef = useRef(false); | ||
|
|
||
| useEffect(() => { | ||
| const previousTransactionsLength = previousTransactions && Object.keys(previousTransactions).length; | ||
| const transactionsLength = transactions && Object.keys(transactions).length; | ||
|
|
||
| if (!previousTransactionsLength || !transactionsLength || previousTransactionsLength === transactionsLength) { | ||
| return; | ||
| } | ||
|
|
||
| // Check if the search block was already triggered | ||
| if (!searchTriggeredRef.current && transactionsLength > previousTransactionsLength) { | ||
| // A transaction was added, trigger the action again | ||
| SearchActions.search({queryJSON, offset}); | ||
| searchTriggeredRef.current = true; // Set the flag to true to prevent further triggers | ||
| } | ||
| }, [transactions, previousTransactions, queryJSON, offset]); | ||
|
|
||
| // Reset the flag using InteractionManager after the search action | ||
| useEffect(() => { | ||
| if (!searchTriggeredRef.current) { | ||
| return; | ||
| } | ||
|
|
||
| // Schedule a task to reset the flag after all current interactions have completed | ||
| const interactionHandle = InteractionManager.runAfterInteractions(() => { | ||
| searchTriggeredRef.current = false; // Reset the flag after interactions | ||
| }); | ||
|
|
There was a problem hiding this comment.
@luacmartins Ideally, we would update the Search snapshot in BE and pop the newly added transaction in the search list via pusher and we wouldn't have to check transactions / previous transactions in this way - but it's better than performing a full page reload from a UX point of view, given that we want to pop the row in with a nice animation.
|
this needs a c+, right ? @ikevin127 |
|
@ishpaul777 I assume it does, coming from the issue - currently we're still polishing the animation and I have to fix the failed checks. Will let you know once this is ready for C+ review 👍 |
|
Nice, thanks for clarifying 🤗 let me know if i can help anyways.. |
…7-searchAnimateHighlight
|
@luacmartins Not sure why the tests are failing, could it be because of the FE implementation mentioned in #49192 ? 🤔 Unit tests (job 1) Unit tests (job 2) |
|
Not sure either. They all seem unrelated. Are they consistently failing? |
|
@luacmartins They seem to be (job 1, 2 and performance) - will try another sync w/ main but if that doesn't do it, not sure what the next steps should be here 🤔 |
|
I don't seem to always get the highlight animation when submitting from an empty state: CleanShot.2024-09-16.at.10.08.06.mp4I've tried to reproduce it and get the animation once in a while, but not reliably |
|
As for the animation, I tested it locally and it looks really good 😄 Great job! 👏 cc @Expensify/design for viz |
@dubielzyk-expensify Thanks for double-checking this, you saved us a regression with this one as I missed checking the case when the list is empty (new account) - which caused the following two issues:
This is how it looks now on a new account when creating the first transaction: Screen.Recording.2024-09-16.at.13.23.02.mov |
|
Boom! That's looking excellent |
|
Nice! This is looking great. @ikevin127 we have some conflicts. Also is this ready for review? |
…7-searchAnimateHighlight
This comment was marked as outdated.
This comment was marked as outdated.
|
♻️ I will look into this today, use some AI to try and find a link between my changes and the tests that are failing. Update: Turns out the reason why tests are failing is caused by the usage of Update 2: Because the Note I had to target specific files because if I were to add the |
|
i will rereview and try to finish this in couple of hours 🙏 |
|
Bug: Changing sorting, highlights and scroll to random expense item Screen.Recording.2024-09-26.at.8.39.19.PM.mov |
|
Bug: Search results scroll and highlights expense when changing status from outstading to All Screen.Recording.2024-09-26.at.8.55.46.PM.mov |
|
Bug: while scrolling down search result, there is auto scroll randomly and sometimes random expense is hightlighted (This might requires account with many (~100+) expenses) Screen.Recording.2024-09-26.at.8.59.52.PM.mov |
This comment was marked as outdated.
This comment was marked as outdated.
|
@ishpaul777 ♻️ I refactored the code to use a single hook (
|
…7-searchAnimateHighlight
|
About to leave for the day, i will take a peek now, and review afresh tomorrow 🙏 |
|
we have conflicts here @ikevin127 i did not face those bugs (or any other bugs) again in my testing, and also code wise it Looks good! |
…7-searchAnimateHighlight
|
✋ 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/luacmartins in version: 9.0.43-0 🚀
|
1 similar comment
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.0.43-0 🚀
|
|
Hey we have a minor regression here. I'm removing the blocker label, and let me know if you'd like to handle this as a follow up. |
This comment was marked as outdated.
This comment was marked as outdated.
|
@Julesssss ✅ I confirm that #50046 is indeed a regression of this PR Actually, the PR's reviewer will open a follow-up and I will review it, coming from #50046 (comment). |
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.0.43-6 🚀
|
| item.isSelected && styles.activeComponentBG, | ||
| isFocused && styles.sidebarLinkActive, | ||
| // Removing some of the styles because they are added to the parent OpacityView via animatedHighlightStyle | ||
| {backgroundColor: 'unset'}, |
There was a problem hiding this comment.
This style overriding caused the following issue:
Which we fixed by moving the style up, under the overflowHidden and changing it to styles.bgTransparent for compatibility with native.
| transactions, | ||
| previousTransactions, | ||
| queryJSON, | ||
| offset, |
There was a problem hiding this comment.
We probably should have added a offsetForRecentChat here as well which would have been always 0. This later caused #54785
Details
Fixed Issues
$ #48716
PROPOSAL:
Tests
Offline tests
QA Steps
TLDR: Same as Tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.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
android.webm
Android: mWeb Chrome
android-mweb.webm
iOS: Native
ios.mp4
iOS: mWeb Safari
ios-mweb.mp4
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov