Skip to content
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: ensure composer not full size when onyx state missing #31602

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pages/home/ReportScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const defaultProps = {
*/
function getReportID(route) {
// // The reportID is used inside a collection key and should not be empty, as an empty reportID will result in the entire collection being returned.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// // The reportID is used inside a collection key and should not be empty, as an empty reportID will result in the entire collection being returned.
// The reportID is used inside a collection key and should not be empty, as an empty reportID will result in the entire collection being returned.

This has been driving me nuts for weeks 😂 mind fixing it? It's also great that the null default value completely went against the warning in the comment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, also... you could maybe update the comment to explain why the 0 is outside of lodashGet() instead of using it as the default value of lodashGet. In fact, maybe I missed that part... why isn't the code like this?

lodashGet(route, 'params.reportID', 0)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'' is not falsy and doesn't fallback.
Similar in TS: '' ?? 0 returns ''

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, that's right. Can you please add that to the comment so that others will understand that too? It's very subtle.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

return String(lodashGet(route, 'params.reportID', null));
return String(lodashGet(route, 'params.reportID') || 0);
}

function ReportScreen({
Expand Down
Loading