-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 'ReportActionItem.js' component to TypeScript #34487
[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
@@ -760,75 +786,54 @@ function ReportActionItem(props) { | |||
)} | |||
</Hoverable> | |||
<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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
@@ -86,7 +86,7 @@ export default <TOnyxKey extends OnyxKey>(onyxKeyName: TOnyxKey): CreateOnyxCont | |||
if (value === null) { | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 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(theme.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