-
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
[TS migration] Migrate 'OptionsListUtils.js' lib to TypeScript #32470
[TS migration] Migrate 'OptionsListUtils.js' lib to TypeScript #32470
Conversation
…s-migration/OptionsListUtils-lib
…s-migration/OptionsListUtils-lib
…s-migration/OptionsListUtils-lib
…s-migration/OptionsListUtils-lib
…s-migration/OptionsListUtils-lib
…s-migration/OptionsListUtils-lib
…s-migration/OptionsListUtils-lib
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.
forgot these ones
…s-migration/OptionsListUtils-lib
@getusha Done! |
We did not find an internal engineer to review this PR, trying to assign a random engineer to #24921 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
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.
Looks good and tests well. Thanks!
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.
const personalDetailList = _.values(personalDetailMap); | ||
const personalDetail = personalDetailList[0] || {}; | ||
const personalDetailList = Object.values(personalDetailMap).filter((details): details is PersonalDetails => !!details); | ||
const personalDetail = personalDetailList[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.
Hi, @kubabutkiewicz, personalDetail
might be undefined
, and this could lead to a crash when later code attempts to access personalDetail.login
later.
App/src/libs/OptionsListUtils.ts
Line 660 in 7962905
result.alternateText = showChatPreviewLine && lastMessageText ? lastMessageText : LocalePhoneNumber.formatPhoneNumber(personalDetail.login ?? ''); |
App/src/libs/OptionsListUtils.ts
Line 665 in 7962905
reportName = ReportUtils.getDisplayNameForParticipant(accountIDs[0]) || LocalePhoneNumber.formatPhoneNumber(personalDetail.login ?? ''); |
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.
Hi @ntdiary !
I think this
App/src/libs/OptionsListUtils.ts
Line 588 in 7962905
const personalDetailList = Object.values(personalDetailMap).filter((details): details is PersonalDetails => !!details); |
personalDetailList
right? so personalDetail
should always be defined in my opinion.Is the crash already happend, or this was just a assumption?
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.
Yeah, it did happen. 😂
It seems that accountIDs
might be an empty array.
test.mp4
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.
@ntdiary do you know if there is an issue for that created?
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.
Let's fix this asap. This blocks testing important parts of the app.
This happens because const personalDetailMap = getPersonalDetailsForAccountIDs(accountIDs, personalDetails);
can be empty json {}
Screen.Recording.2024-01-28.at.9.05.49.PM.mov
} else if (ReportUtils.isReportMessageAttachment({text: report.lastMessageText, html: report.lastMessageHtml, translationKey: report.lastMessageTranslationKey})) { | ||
lastMessageTextFromReport = `[${Localize.translateLocal(report.lastMessageTranslationKey || 'common.attachment')}]`; | ||
} else if (ReportUtils.isReportMessageAttachment({text: report?.lastMessageText ?? '', html: report?.lastMessageHtml, translationKey: report?.lastMessageTranslationKey, type: ''})) { | ||
lastMessageTextFromReport = `[${Localize.translateLocal((report?.lastMessageTranslationKey ?? 'common.attachment') as TranslationPaths)}]`; |
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.
@kubabutkiewicz Should we revert this or fix the raised regressions. |
I am publishing the fix now |
That's because this PR didn't hit staging yet. Only QA team is reporting bugs. Not contributors |
🚀 Deployed to staging by https://github.com/deetergp in version: 1.4.33-0 🚀
|
.map((tag) => ({name: tag, enabled: true})); | ||
const filteredTags = enabledTags.filter((tag) => !selectedOptionNames.includes(tag.name)); | ||
|
||
if (selectedOptions) { |
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 caused regression. selectedOptions
is array and always truthy.
Should be selectedOptions.length
.
Issue created for this: #35423
🚀 Deployed to production by https://github.com/francoisl in version: 1.4.33-5 🚀
|
if (name) { | ||
const categoryObject: Category = { | ||
name, | ||
enabled: categories[name].enabled ?? false, |
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.
Category should have been accessed safely, rare case where categories[name]
is undefined. ref: #36622
Details
Fixed Issues
$ #24921
Tests
Offline tests
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)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label 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.mp4
Android: mWeb Chrome
mchrome.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
msafari.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4