fix(frontend): single-call chainMismatchWriteMessage in WarBow refresh runRefresh (GitLab #173) #377

Merged
Brouie merged 1 commit from fix/glab-173-warbow-refresh-section-polish into main 2026-05-07 11:59:55 +00:00
Brouie commented 2026-05-07 03:19:38 +00:00 (Migrated from gitlab.com)

closes #173. defensive partial #174 (does not close — separate post-loop warning state needed for that, leaving open).

what changed

frontend/src/pages/timecurve/TimeCurveProtocolWarbowRefreshSection.tsx — two small fixes from the #160 follow-ups:

  1. runRefresh extracts chainMismatchWriteMessage(chainId) to a cm local. before: helper invoked twice in the same branch (once in if, once as setTxErr arg with a dead ?? "Wrong network for writes." fallback that could never fire). after: single call, behaviorally identical.

  2. loadFromIndexer wraps the for (const c of chunk.candidates) iteration with Array.isArray(chunk.candidates). before: malformed indexer response that parses but lacks the candidates array (older schema, intercepting proxy, partial JSON) throws inside the loop. the existing top-level catch at lines 131-136 (added in fff7946 per #170) catches it and surfaces friendlyRevertFromUnknown, but the guard is cheap and means the user gets a clean empty-load instead of a friendly revert error. defensive only.

verification

  • npm run typecheck clean.
  • npm test -- --run — 50 files / 295 passed (no regressions, same count as pre-patch).
  • npm run lint — 0 errors. one pre-existing fast-refresh warning in IndexerConnectivityContext.tsx untouched.

scope notes

  • comprehensive Vitest coverage for this component (#175) is intentionally out of scope — that needs a @testing-library/react provider-mock harness which is its own MR.
  • the silent-truncation guard from #174 also requires a post-loop lastNextOffset track + warning state — separate from the Array.isArray guard added here. #174 stays open.

cc @PlasticDigits

closes #173. defensive partial #174 (does not close — separate post-loop warning state needed for that, leaving open). ## what changed `frontend/src/pages/timecurve/TimeCurveProtocolWarbowRefreshSection.tsx` — two small fixes from the #160 follow-ups: 1. `runRefresh` extracts `chainMismatchWriteMessage(chainId)` to a `cm` local. before: helper invoked twice in the same branch (once in `if`, once as `setTxErr` arg with a dead `?? "Wrong network for writes."` fallback that could never fire). after: single call, behaviorally identical. 2. `loadFromIndexer` wraps the `for (const c of chunk.candidates)` iteration with `Array.isArray(chunk.candidates)`. before: malformed indexer response that parses but lacks the `candidates` array (older schema, intercepting proxy, partial JSON) throws inside the loop. the existing top-level catch at lines 131-136 (added in `fff7946` per #170) catches it and surfaces `friendlyRevertFromUnknown`, but the guard is cheap and means the user gets a clean empty-load instead of a friendly revert error. defensive only. ## verification - `npm run typecheck` clean. - `npm test -- --run` — 50 files / 295 passed (no regressions, same count as pre-patch). - `npm run lint` — 0 errors. one pre-existing fast-refresh warning in `IndexerConnectivityContext.tsx` untouched. ## scope notes - comprehensive Vitest coverage for this component (#175) is intentionally out of scope — that needs a `@testing-library/react` provider-mock harness which is its own MR. - the silent-truncation guard from #174 also requires a post-loop `lastNextOffset` track + warning state — separate from the Array.isArray guard added here. #174 stays open. cc @PlasticDigits
PlasticDigits commented 2026-05-07 11:59:56 +00:00 (Migrated from gitlab.com)

mentioned in commit df7abc4d75

mentioned in commit df7abc4d75e1cdababb72fd7b14a8db13c8266e9
PlasticDigits (Migrated from gitlab.com) merged commit df7abc4d75 into main 2026-05-07 11:59:56 +00:00
PlasticDigits commented 2026-05-13 15:13:33 +00:00 (Migrated from gitlab.com)

mentioned in commit b62524499a

mentioned in commit b62524499a5f8beadc4b0b84186053fda0c8eba3
Sign in to join this conversation.
No reviewers
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!377
No description provided.