Skip to content
3 changes: 0 additions & 3 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,6 @@ function updateGroupChatName(reportID: string, reportName: string) {
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
reportName: ReportConnection.getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]?.reportName ?? null,
errors: {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure how our problem gets solved by not setting errors here. The problem mentioned here still exists. When openReport is called, errorFields comes back as follows with null (as shown below) and, strangely, FE resets the errorFields in report in Onyx. Don’t we need to get to the bottom of this?

Screenshot 2024-07-20 at 11 17 08 PM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Investigating

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rojiphil Hey, I'm still unable to reproduce the issue you're mentioning with RBR. You can check the video below. Even after the openReport calls, the RBR isn't disappearing. I've also tried reloading the page, but the RBR remains until we manually remove it by pressing the cross. Please let me know if I am missing any step

Screen.Recording.2024-07-22.at.1.54.12.PM.1.1.1.mov

@Nodebrute Nodebrute Jul 22, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure how our problem gets solved by not setting errors here. The problem mentioned here still exists. When openReport is called, errorFields comes back as follows with null (as shown below) and, strangely, FE resets the errorFields in report in Onyx. Don’t we need to get to the bottom of this?

We don't need to set errors here. The backend returns errorFields in case of failure, which is sufficient to display errors here. We don't even set errors when updating the room name. I don't think we need to include errors in the failure data when updating the group name. Removing errors seems to address the main issue of removing RBR after pressing the cross. Let me know your thoughts.

App/src/libs/actions/Report.ts

Lines 2293 to 2305 in eec4d6a

const failureData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
reportName: previousName,
},
},
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
value: {[optimisticRenamedAction.reportActionID]: null},
},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rojiphil Additionally, the backend is returning the merge method, so it is not affecting the existing errorFields in the Onyx.

Screen.Recording.2024-07-22.at.2.41.36.PM.mov

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to set errors here. The backend returns errorFields in case of failure, which is sufficient to display errors here.

This is a good cleanup. Earlier as mentioned here settings also had a provision to update room name. But, now, since editing the room name is no longer present within settings page, we can avoid setting GBR for settings menu.

reportName: Localize.translateLocal('common.genericErrorMessage'),
},
pendingFields: {
reportName: null,
},
Expand Down
28 changes: 12 additions & 16 deletions src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -712,22 +712,18 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD
promotedActions={promotedActions}
/>

{menuItems.map((item) => {
const brickRoadIndicator =
ReportUtils.hasReportNameError(report) && item.key === CONST.REPORT_DETAILS_MENU_ITEM.SETTINGS ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined;
return (
<MenuItem
key={item.key}
title={translate(item.translationKey)}
subtitle={item.subtitle}
icon={item.icon}
onPress={item.action}
isAnonymousAction={item.isAnonymousAction}
shouldShowRightIcon={item.shouldShowRightIcon}
brickRoadIndicator={brickRoadIndicator ?? item.brickRoadIndicator}
/>
);
})}
{menuItems.map((item) => (
<MenuItem
key={item.key}
title={translate(item.translationKey)}
subtitle={item.subtitle}
icon={item.icon}
onPress={item.action}
isAnonymousAction={item.isAnonymousAction}
shouldShowRightIcon={item.shouldShowRightIcon}
brickRoadIndicator={item.brickRoadIndicator}
/>
))}

{shouldShowDeleteButton && (
<MenuItem
Expand Down