[TS migration] Migrate 'ReportActionItem.js' component to TypeScript#34487
Conversation
This reverts commit 1c13e82.
…s-migration/ReportActionItem2/component
…s-migration/ReportActionItem2/component
…s-migration/ReportActionItem2/component
| <View style={styles.reportActionSystemMessageContainer}> | ||
| <InlineSystemMessage message={props.action.error} /> | ||
| {/* @ts-expect-error TODO check if there is a field on the reportAction object */} | ||
| <InlineSystemMessage message={action.error} /> |
There was a problem hiding this comment.
I was not able to check if this field error exists on ReportAction type so not sure if I should add this to type of this is mistake
There was a problem hiding this comment.
Maybe ask on slack, or make an artificial error to test this?
…s-migration/ReportActionItem2/component
| const getDraftMessage = (drafts: OnyxCollection<OnyxTypes.ReportActionsDrafts>, reportID: string, action: OnyxTypes.ReportAction): string | undefined => { | ||
| const originalReportID = ReportUtils.getOriginalReportID(reportID, action); | ||
| const draftKey = `${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${originalReportID}`; | ||
| const draftMessage = drafts?.[draftKey]?.[action.reportActionID]; | ||
| return typeof draftMessage === 'string' ? draftMessage : draftMessage?.message; | ||
| }; |
There was a problem hiding this comment.
Please test this logic change extensively 🙂
…s-migration/ReportActionItem2/component
…s-migration/ReportActionItem2/component
…s-migration/ReportActionItem2/component
…s-migration/ReportActionItem2/component
…s-migration/ReportActionItem2/component
…s-migration/ReportActionItem2/component
…s-migration/ReportActionItem2/component
|
@rushatgabhane kind bump 😄 |
Reviewer Checklist
Screenshots/Videos |
|
@luacmartins looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
|
Tests were passing. |
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 1.4.49-0 🚀
|
There was a problem hiding this comment.
@kubabutkiewicz are you able to raise quick PR fixing them? This caused deploy blocker - #37965
| initialValue: {} as OnyxTypes.Report, | ||
| }, | ||
| policyReportFields: { | ||
| key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY_REPORT_FIELDS}${report.policyID ?? ''}`, |
There was a problem hiding this comment.
We should avoid fallback to empty string when prefixed with onyx key. xxx_ will pull all data.
| key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY_REPORT_FIELDS}${report.policyID ?? ''}`, | |
| key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY_REPORT_FIELDS}${report.policyID ?? 0}`, |
| initialValue: {}, | ||
| }, | ||
| policy: { | ||
| key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY}${report.policyID ?? ''}`, |
There was a problem hiding this comment.
Same here:
| key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY}${report.policyID ?? ''}`, | |
| key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY}${report.policyID ?? 0}`, |
@luacmartins I just got caught off guard by the same thing in another PR, they were also not passing here 😬
Discussion here: https://expensify.slack.com/archives/C01GTK53T8Q/p1709911998098289 |
|
hmm interesting, I did not see that before the merge. Thanks for pointing that out! |
Same for me in my other PR 😕 |
|
This PR is causing this regression #38049 |
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.4.50-5 🚀
|
|
Commented on the issue
@rushatgabhane , if you're due compensation, please comment on the issue, otherwise I'll close next week. Thx |
| throw new Error(`useOnyxContext must be used within a OnyxProvider [key: ${onyxKeyName}]`); | ||
| } | ||
| return value; | ||
| return value as NonNullable<OnyxValue<TOnyxKey>>; |
There was a problem hiding this comment.
We have a case where we create a context hook from createOnyxContext it might return undefined sometimes and we are not covering this case in our code, that is why app is crashing in specific scenario. More info on proposal: #52633 (comment)








Details
Fixed Issues
$ #31982
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.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