-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fixed Loading spinner on login form and crash after Login #3865
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,9 +169,9 @@ function createOption(personalDetailList, report, draftComments, { | |
}) { | ||
const hasMultipleParticipants = personalDetailList.length > 1; | ||
const personalDetail = personalDetailList[0]; | ||
const hasDraftComment = report | ||
const reportDraftComment = report | ||
&& draftComments | ||
&& lodashGet(draftComments, `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${report.reportID}`, '').length > 0; | ||
&& lodashGet(draftComments, `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${report.reportID}`, ''); | ||
|
||
const hasOutstandingIOU = lodashGet(report, 'hasOutstandingIOU', false); | ||
const lastActorDetails = report ? _.find(personalDetailList, {login: report.lastActorEmail}) : null; | ||
|
@@ -215,7 +215,7 @@ function createOption(personalDetailList, report, draftComments, { | |
login: !hasMultipleParticipants ? personalDetail.login : null, | ||
reportID: report ? report.reportID : null, | ||
isUnread: report ? report.unreadActionCount > 0 : null, | ||
hasDraftComment, | ||
hasDraftComment: !!reportDraftComment && reportDraftComment.length > 0, | ||
parasharrajat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
keyForList: report ? String(report.reportID) : personalDetail.login, | ||
searchText: getSearchText(report, personalDetailList), | ||
isPinned: lodashGet(report, 'isPinned', false), | ||
|
@@ -297,13 +297,13 @@ function getOptions(reports, personalDetails, draftComments, activeReportID, { | |
return; | ||
} | ||
|
||
const hasDraftComment = report | ||
&& draftComments | ||
&& lodashGet(draftComments, `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${report.reportID}`, '').length > 0; | ||
const reportDraftComment = report | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar comment here. I don't get why this variable change is relevant to your PR. |
||
&& draftComments | ||
&& lodashGet(draftComments, `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${report.reportID}`, ''); | ||
|
||
const shouldFilterReportIfEmpty = !showReportsWithNoComments && report.lastMessageTimestamp === 0; | ||
const shouldFilterReportIfRead = hideReadReports && report.unreadActionCount === 0; | ||
const shouldShowReportIfHasDraft = showReportsWithDrafts && hasDraftComment; | ||
const shouldShowReportIfHasDraft = showReportsWithDrafts && reportDraftComment && reportDraftComment.length > 0; | ||
const shouldFilterReport = shouldFilterReportIfEmpty || shouldFilterReportIfRead; | ||
if (report.reportID !== activeReportID | ||
&& !report.isPinned | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 get why changing this variable from boolean to object has anything to do with your fixing loading spinner? It looks like it's just used as a boolean below anyway. Can you explain?
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.
So There are two issues, I am trying to fix in this PR. Sometimes, the
lodashGet(draftComments,
${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${report.reportID}, '')
returns null. So it will throw an error here that.length
is not present.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.
Ah okay, i see. I didn't expect that value to be null (and hence not use the lodash get default value). Weird. Anyway, thanks for the fix 👍