TimeCurveProtocolWarbowRefreshSection: chainMismatchWriteMessage called twice in runRefresh — extract to local #173

Closed
opened 2026-05-07 01:58:31 +00:00 by Brouie · 5 comments
Brouie commented 2026-05-07 01:58:31 +00:00 (Migrated from gitlab.com)

Severity: P3 — cosmetic / defensive

split out of #160 follow-up per @PlasticDigits — "all of these findings need to have issues opened for them".

location

frontend/src/pages/timecurve/TimeCurveProtocolWarbowRefreshSection.tsx:146-149 (HEAD 284c15c):

if (chainMismatchWriteMessage(chainId)) {
  setTxErr(chainMismatchWriteMessage(chainId) ?? "Wrong network for writes.");
  return;
}

chainMismatchWriteMessage(chainId) is invoked twice — once in the if, once in the setTxErr argument. cosmetic redundancy. the ?? "Wrong network for writes." fallback is also unreachable inside the if-true branch since the helper just returned a non-null value.

fix shape

extract to a local:

const cm = chainMismatchWriteMessage(chainId);
if (cm) {
  setTxErr(cm);
  return;
}

matches the pattern used elsewhere in the codebase. drops the dead ?? fallback.

acceptance criteria

  • chainMismatchWriteMessage(chainId) called once in runRefresh
  • no behavior change observable from outside the function
  • npm run typecheck + npm test clean

origin

split from #160 follow-up notes ("Finding 4: P3 cosmetic double-call"). bundling target: this would naturally MR alongside the P3 fresh-load reset (also from #160 follow-ups).

cc @PlasticDigits

**Severity:** P3 — cosmetic / defensive split out of #160 follow-up per @PlasticDigits — "all of these findings need to have issues opened for them". ## location `frontend/src/pages/timecurve/TimeCurveProtocolWarbowRefreshSection.tsx:146-149` (HEAD `284c15c`): ``` if (chainMismatchWriteMessage(chainId)) { setTxErr(chainMismatchWriteMessage(chainId) ?? "Wrong network for writes."); return; } ``` `chainMismatchWriteMessage(chainId)` is invoked twice — once in the `if`, once in the `setTxErr` argument. cosmetic redundancy. the `?? "Wrong network for writes."` fallback is also unreachable inside the `if`-true branch since the helper just returned a non-null value. ## fix shape extract to a local: ``` const cm = chainMismatchWriteMessage(chainId); if (cm) { setTxErr(cm); return; } ``` matches the pattern used elsewhere in the codebase. drops the dead `??` fallback. ## acceptance criteria - [ ] `chainMismatchWriteMessage(chainId)` called once in `runRefresh` - [ ] no behavior change observable from outside the function - [ ] `npm run typecheck` + `npm test` clean ## origin split from #160 follow-up notes ("Finding 4: P3 cosmetic double-call"). bundling target: this would naturally MR alongside the P3 fresh-load reset (also from #160 follow-ups). cc @PlasticDigits
Brouie commented 2026-05-07 02:02:52 +00:00 (Migrated from gitlab.com)

mentioned in issue #175

mentioned in issue #175
Brouie commented 2026-05-07 02:06:00 +00:00 (Migrated from gitlab.com)

mentioned in issue #176

mentioned in issue #176
Brouie commented 2026-05-07 02:09:58 +00:00 (Migrated from gitlab.com)

mentioned in issue #160

mentioned in issue #160
Brouie commented 2026-05-07 03:19:40 +00:00 (Migrated from gitlab.com)

mentioned in merge request !377

mentioned in merge request !377
PlasticDigits commented 2026-05-07 11:59:55 +00:00 (Migrated from gitlab.com)

mentioned in commit df7abc4d75

mentioned in commit df7abc4d75e1cdababb72fd7b14a8db13c8266e9
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-05-07 11:59:56 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
code/yieldomega#173
No description provided.