-
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
Fallback on report #19127
Fallback on report #19127
Conversation
@fedirjh @srikarparsi 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] |
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.
Oh wow, thanks!
|
Also yeah, will be a good clean up item to add a bunch of these checks when we're returning data from php so we can keep these conditionals minimal in App |
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-05-17.at.18.19.16.movMobile Web - ChromeHaving issus with chrome on android Mobile Web - SafariScreen.Recording.2023-05-17.at.18.23.04.moviOSAndroidScreen.Recording.2023-05-17.at.18.21.49.mov |
key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID}`, | ||
key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID || report.reportID}`, |
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 don't know if this change makes sense - the parentReport is never the report.reportID right? Like can we just return nothing here if it doesn't exist?
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.
Was wondering the same, we should not retrun a wrong report as parent. I think we should return 0 in this case and make sure we check for that -> its root does not have a parent
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.
Without this, Onyx will return all the reports in the report collection if report.parentReportID
is undefined because the key will be report_
. I spoke to @tgolen about this and we agreed that falling back to the report was a good solution in this case. As I mentioned in the OP, we could probably consolidate these into a single Onyx key report
so the component always gets the right data and doesn't need to have any logic to decide which report it should use.
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.
Without this, Onyx will return all the reports in the report collection if report.parentReportID is undefined because the key will be report_.
Does that also happen with report_0?
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.
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.
Does that also happen with report_0?
I don't think it should, no. It's expected that if you subscribe to a key like report_
that it gives you the entire collection and that is normal behavior. The undefined
reportID is a nasty gotcha that results in subscribing to the entire collection.
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.
Tests well, thanks!
Fallback on report (cherry picked from commit 3e5d81b)
…-19127 🍒 Cherry pick PR #19127 to staging 🍒
🚀 Cherry-picked to staging by https://github.com/luacmartins in version: 1.3.15-5 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.3.15-12 🚀
|
🚀 Cherry-picked to staging by https://github.com/AndrewGable in version: 1.3.28-2 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/AndrewGable in version: 1.3.28-5 🚀
|
Details
When the parentReportID key was undefined, we returned
reports_
to Onyx which resulted in it returning the entirereport
collection to the header component 😅 Additionally, this conditional always returned true.@thienlnam not sure if we can clean up more of the logic and make Onyx always return either the parentReport or the report as a
report
prop so we don't need to check for it within the component.cc @thienlnam
Fixed Issues
$ #19123
Tests
CMD + K
Offline tests
N/A
QA Steps
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 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
web.mov
Mobile Web - Chrome
chrome.mov
Mobile Web - Safari
safari.mov
Desktop
desktop.mov
iOS
ios.mov
Android
android.mov