-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search - Highlight newly added expense #49192
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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 |
@luacmartins Thanks for double checking this and catching the bugs 👍 I just applied the fixes for the two bugs mentioned (ref1, ref2) and also performed the refactoring requested in #49192 (comment) which ensures we keep the logic in the Search component small. Here's a video after the fix was applied: bugfixes.movPlease check this again and let me know if there are any other issues 🤞 |
Nice! Thanks for working on those. It seems like a few tests are failing. @ishpaul777 could you please review this PR again once the tests above are fixed? |
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
✋ 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 🚀
|
@@ -77,6 +77,9 @@ function ReportListItem<TItem extends ListItem>({ | |||
styles.overflowHidden, | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Details
Fixed Issues
$ #48716
PROPOSAL:
Tests
Offline tests
QA Steps
TLDR: Same as Tests.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.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