-
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
Undo defaults values for onyx ids PureReportActionItem #55536
Undo defaults values for onyx ids PureReportActionItem #55536
Conversation
…to undo-defaults-values-purereportactionitem
…to undo-defaults-values-purereportactionitem
…to undo-defaults-values-purereportactionitem
…to undo-defaults-values-purereportactionitem
…to undo-defaults-values-purereportactionitem
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.
You have some lint errors
@@ -109,26 +110,26 @@ function ReservationView({reservation}: ReservationViewProps) { | |||
); | |||
} | |||
|
|||
const renderItem = ({item}: {item: TripReservationUtils.ReservationData}) => <ReservationView reservation={item.reservation} />; | |||
const renderItem = ({item}: {item: ReservationData}) => <ReservationView reservation={item.reservation} />; |
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 renderItem = ({item}: {item: ReservationData}) => <ReservationView reservation={item.reservation} />; | |
const renderItem = ({item}: ListRenderItemInfo<ReservationData>) => <ReservationView reservation={item.reservation} />; |
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.
@@ -507,7 +555,7 @@ function PureReportActionItem({ | |||
const contextValue = useMemo( | |||
() => ({ | |||
anchor: popoverAnchorRef.current, | |||
report: {...report, reportID: report?.reportID ?? ''}, | |||
report: report?.reportID ? {...report, reportID: report?.reportID} : undefined, |
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 make sure about this, looks like a dangerous change 👀
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.
hmm actually shouldn't we just do report: {...report}
? since if there is a report there's also reportID
right? there is no way that we have a report without reportID
@fabioh8010
report: OnyxTypes.Report; | ||
action: OnyxTypes.ReportAction; | ||
}; | ||
contextValue: ShowContextMenuContextProps; |
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.
Why was this changed?
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.
Because of the change above https://github.com/Expensify/App/pull/55536/files/84d6eb5c1c2932b042ad1b3cde8ffbf5bd0d73ec#diff-a7f41a67ae98f78eb397d452128d1a83b5b142976e61efe2302e52853604cf3a
I also checked it passed just undefined to PureReportActionItem and worked fine will do couple more tests to make sure 100%
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.
But can we not make this change? It looks like a regression magnet to me.
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 think we still should do it I trace how report is passed here and its always comes from Onyx so its possible that report
here will be undefined as we removed defaults in PureReportActionItem
so previous type was wrong
…to undo-defaults-values-purereportactionitem
@paultsimura Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@kubabutkiewicz Let's remove |
@kubabutkiewicz please resolve conflicts 🙏 |
…to undo-defaults-values-purereportactionitem
…to undo-defaults-values-purereportactionitem
@@ -60,9 +60,9 @@ function MentionReportRenderer({style, tnode, TDefaultRenderer, ...defaultRender | |||
const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT); | |||
|
|||
const currentReportID = useCurrentReportID(); | |||
const currentReportIDValue = currentReportIDContext || currentReportID?.currentReportID; | |||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing |
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 like this can be removed
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 think we should leave it if currentReportIDContext
would be ''
the ??
operator wont work and will assign to currentReportIDValue
''
but if we use ||
it will correctly assign currentReportID?.currentReportID
. And by default in MentionReportContext currentReportID
is ''
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 meant the // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
only, because my linter didn't throw any warning with it removed.
Looks like it was just slow, let's keep it then.
@@ -1743,7 +1751,7 @@ function handleUserDeletedLinksInHtml(newCommentText: string, originalCommentMar | |||
} | |||
|
|||
/** Saves a new message for a comment. Marks the comment as edited, which will be reflected in the UI. */ | |||
function editReportComment(reportID: string, originalReportAction: OnyxEntry<ReportAction>, textForNewComment: string, videoAttributeCache?: Record<string, string>) { | |||
function editReportComment(reportID: string | undefined, originalReportAction: OnyxEntry<ReportAction>, textForNewComment: string, videoAttributeCache?: Record<string, string>) { |
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.
Why not return early if !reportID
here and in the functions below?
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.
When I do this the the TS will complain about this
const parameters: UpdateCommentParams = {
reportID: originalReportID,
reportComment: htmlForNewComment,
reportActionID,
};
as originalReportID is of type string | undefined
and UpdateCommentParams
expect reportID
will be of type string
but when I do this
if (!originalReportID || !originalReportAction) {
return;
}
everything looks good
report: OnyxTypes.Report; | ||
action: OnyxTypes.ReportAction; | ||
}; | ||
contextValue: ShowContextMenuContextProps; |
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.
But can we not make this change? It looks like a regression magnet to me.
…to undo-defaults-values-purereportactionitem
Ok @paultsimura I think all comments are resolved/answered |
Thanks, giving it another 👀 soon! |
…to undo-defaults-values-purereportactionitem
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid.webmAndroid: mWeb ChromeChrome.webmiOS: NativeiOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.-.2025-01-24.at.13.38.40.mp4MacOS: Chrome / SafariScreen.Recording.2025-01-24.at.13.32.58.movMacOS: DesktopScreen.Recording.2025-01-24.at.13.35.56.mov |
@kubabutkiewicz let's fix the conflicts one last time and we're g2g ✔️ |
…to undo-defaults-values-purereportactionitem
@paultsimura conflicts resolved |
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.
LGTM ✔️
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.
Thanks for all the hard work. I have some requests.
src/components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer/MentionReportContext.tsx
Show resolved
Hide resolved
<MenuItemWithTopDescription | ||
shouldRenderAsHTML | ||
description={translate('task.description')} | ||
title={report.description ?? ''} | ||
onPress={() => Navigation.navigate(ROUTES.REPORT_DESCRIPTION.getRoute(report.reportID, Navigation.getReportRHPActiveRoute()))} | ||
title={report?.description ?? ''} |
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 should not be defaulted
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.
Are we sure about that? the new rule is only for IDs
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 right good point
…to undo-defaults-values-purereportactionitem
@neil-marcellini I resolved comments from you, you can recheck! |
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.
Good to go. Thanks for the updates.
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/neil-marcellini in version: 9.0.90-0 🚀
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.0.90-6 🚀
|
Explanation of Change
Fixed Issues
$ #55745
PROPOSAL:
Tests
Login to app
Go to some chat
Send a message
Open context menu
Add emoji
Open context menu
Create a thread
Open context menu
Delete message
Open context menu
Edit message
Login to app
Go to some workspace chat
Submit an manual expense
Go again to some workspace chat
Send a Distance expense
Go again to workspace chat
Send a scan
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.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 and/or tagged@Expensify/design
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
![image](https://github.com/user-attachments/assets/d27b6aa7-70f5-4a6c-90b1-8d84dc0d2bcb)Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
![image](https://github.com/user-attachments/assets/6267edb9-7a8d-4378-ac82-54024e2eed5c)MacOS: Desktop
![image](https://github.com/user-attachments/assets/8be91da0-0651-406d-bbf7-aeb05767b4ef)