-
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
fix: show existing reports while loading #25159
Conversation
@narefyev91 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] |
Sorry @s-alves10 that this process has not been very smooth, I have been caught in higher priority issues without being able to give this proper time I tested your PR for
and seems to be fixing both. Can you update with and resolve conflicts so we can give review this and continue? 🙏 |
Conflicts were removed. Please check |
@s-alves10 thanks! @narefyev91 can you review and complete checklist 🙏 ? |
const reportIDsRef = useRef(null); | ||
const isLoading = SessionUtils.didUserLogInDuringSession() && isLoadingReportData; | ||
const optionListItems = useMemo(() => { | ||
const reportIDs = SidebarUtils.getOrderedReportIDs(currentReportID, chatReports, betas, policies, priorityMode, allReportActions); | ||
if (deepEqual(reportIDsRef.current, reportIDs)) { | ||
return reportIDsRef.current; | ||
} | ||
reportIDsRef.current = reportIDs; | ||
return reportIDs; | ||
}, [allReportActions, betas, chatReports, currentReportID, policies, priorityMode]); | ||
|
||
const isLoading = SessionUtils.didUserLogInDuringSession() && isLoadingReportData; | ||
if (isLoading && !reportIDsRef.current && !currentReportID) { | ||
reportIDsRef.current = reportIDs; | ||
} | ||
if (!isLoading) { | ||
reportIDsRef.current = reportIDs; | ||
} | ||
return reportIDsRef.current || []; | ||
}, [allReportActions, betas, chatReports, currentReportID, policies, priorityMode, isLoading]); |
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.
@s-alves10 can you add some comments trying to say why we using this ref and notes on each of the cases you have there?
It is just not very easy to understand why we have this complexity
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.
Comments added
Tested: still fixing the issues after conflicts resolved Screen.Recording.2023-08-24.at.3.05.30.PM.mov |
@@ -26,10 +30,11 @@ const propTypes = { | |||
}; | |||
|
|||
const defaultProps = { | |||
style: [styles.flex1], |
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.
you can just use style: {styles.flex1}
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.
Updated
@s-alves10 can you please sync you fork and branch with latest main |
Interesting that on latest main and changes from you branch - i get this one web - @s-alves10 can you check that code is still working? web.mov |
What's wrong with that? I think it's working fine |
Hmm should it not show current opened chat at the top? during loading? |
Please let me know the expected behavior. Did I misunderstand #23735? |
I think it is just not explicitly said, but I think the expected should be the same for mobile and desktop/web. I don't see why we should have different behaviour. The expected behaviour is: Show the loaded report + skeleton until we have loaded all reports. |
Please take a look |
@s-alves10 you got conflicts :( |
|
||
const isLoading = SessionUtils.didUserLogInDuringSession() && isLoadingReportData; | ||
// We need to update existing reports only once while loading because they are updated several times during loading and causes this reguression: https://github.com/Expensify/App/issues/24596#issuecomment-1681679531 |
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.
// We need to update existing reports only once while loading because they are updated several times during loading and causes this reguression: https://github.com/Expensify/App/issues/24596#issuecomment-1681679531 | |
// We need to update existing reports only once while loading because they are updated several times during loading and causes this regression: https://github.com/Expensify/App/issues/24596#issuecomment-1681679531 |
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.
Updated
src/pages/iou/WaypointEditor.js
Outdated
/** Recent waypoints array */ | ||
recentWaypoints: PropTypes.arrayOf(PropTypes.object), | ||
|
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.
Bad conflicts resolution?
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.
It was the source of lint error. I resolved the conflicts
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.
Will you take a look again?
if ((isLoading && !reportIDsRef.current) || (_.isEmpty(reportIDsRef.current) && currentReportID)) { | ||
reportIDsRef.current = reportIDs; | ||
} | ||
if (!isLoading) { |
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.
i think you can move this to 78 line too like if (long condition || !isLoading)
Reviewer Checklist
Screenshots/VideosWebweb.movMobile Web - Chromeandroid-web.movMobile Web - Safariios-web.movDesktopdesktop.moviOSios.movAndroidandroid.mov |
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! Now we have fully consistency between all platforms
🎀 👀 🎀 C+ reviewed
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/aldo-expensify in version: 1.3.59-0 🚀
|
🚀 Deployed to staging by https://github.com/aldo-expensify in version: 1.3.60-0 🚀
|
🚀 Deployed to staging by https://github.com/aldo-expensify in version: 1.3.60-0 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.3.59-5 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.3.60-3 🚀
|
Details
Show existing reports in LHN while loading all reports
Fixed Issues
$ #24596
PROPOSAL: #24596 (comment)
Tests
Offline tests
This can't be tested in offline mode
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
Web
24596_mac_chrome.mp4
Mobile Web - Chrome
24596_android_chrome.mp4
Mobile Web - Safari
24596_ios_safari.mp4
Desktop
24596_mac_desktop.mp4
iOS
24596_ios_native.mp4
Android
24596_android_native.mp4