Skip to content

Commit 2abb02b

Browse files
Move willShowGreenSubmit check to outer if for optimization
Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
1 parent e3605a4 commit 2abb02b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/libs/actions/OnyxDerived/configs/reportAttributes.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,21 +298,21 @@ export default createOnyxDerivedValueConfig({
298298
);
299299

300300
// When the report is ready to submit, always show the green Submit badge
301-
// regardless of violations — the user should submit first, then fix.
301+
// regardless of violations — the user can submit without fix.
302302
const willShowGreenSubmit = requiresAttention && actionGreenBadge === CONST.REPORT.ACTION_BADGE.SUBMIT;
303303

304304
// if report has errors or violations, show red dot
305-
if (reasonAndReportAction) {
305+
if (reasonAndReportAction && !willShowGreenSubmit) {
306306
needsParentChatErrorPropagation = true;
307307

308308
// RBR/Fix mirrors GBR's access rule: only show on the child when the user can't already
309309
// see it on the parent workspace chat. The parent still gets ERROR/FIX through the
310310
// propagation loop below, so the actionable indicator surfaces on the workspace chat row
311311
// (which is where C+ wants it). Skips when the chat parent isn't accessible to the user.
312-
// Also skip setting ERROR when we'll show the green Submit badge — let the user submit first.
312+
// Also skip setting ERROR when we'll show the green Submit badge — let the user submit without fix.
313313
const chatPolicy = chatReport?.policyID ? policies?.[`${ONYXKEYS.COLLECTION.POLICY}${chatReport.policyID}`] : undefined;
314314
const isChildOfAccessiblePolicyExpenseChat = !!chatReport && isPolicyExpenseChat(chatReport) && (!!chatReport.isOwnPolicyExpenseChat || isPolicyAdmin(chatPolicy));
315-
if (!isChildOfAccessiblePolicyExpenseChat && !willShowGreenSubmit) {
315+
if (!isChildOfAccessiblePolicyExpenseChat) {
316316
brickRoadStatus = CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR;
317317
actionBadge = CONST.REPORT.ACTION_BADGE.FIX;
318318
actionTargetReportActionID = reasonAndReportAction.reportAction?.reportActionID;

0 commit comments

Comments
 (0)