Skip to content

fix: repair unclosed blocks left by merges in FeeEstimator and SorobanPanel - #421

Merged
k-deejah merged 1 commit into
Sorokit:mainfrom
jadonamite:fix/repair-unclosed-blocks-feeestimator-sorobanpanel
Jul 30, 2026
Merged

fix: repair unclosed blocks left by merges in FeeEstimator and SorobanPanel#421
k-deejah merged 1 commit into
Sorokit:mainfrom
jadonamite:fix/repair-unclosed-blocks-feeestimator-sorobanpanel

Conversation

@jadonamite

@jadonamite jadonamite commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Problem

src/components/FeeEstimator.tsx and src/components/SorobanPanel.tsx on main each contain two interleaved versions of the same code, left behind by botched conflict resolutions. The result is unclosed blocks, so neither file parses:

src/components/FeeEstimator.tsx(51,7): error TS1005: 'try' expected.
src/components/FeeEstimator.tsx(134,15): error TS2657: JSX expressions must have one parent element.
src/components/SorobanPanel.tsx(212,7): error TS1005: 'try' expected.
src/components/SorobanPanel.tsx(490,34): error TS1005: ':' expected.
src/components/SorobanPanel.tsx(542,1): error TS1005: '}' expected.

Because they don't parse, tsc -b aborts, npm run build fails, and every test file that imports either component fails to collect. src/components/SorobanPanel.test.tsx is broken the same way — a truncated test body left a describe unclosed.

The breakage traces to commit f50710c (subject: test(ui): resolve 324 - add tests for Badge, Input, and FeeEstimator), which mangled the components while adding tests; 76718b0 is the last commit where FeeEstimator.tsx still parsed.

What this changes

Everything here is limited to removing duplicated fragments and restoring the intended structure. Where two versions of a behaviour existed, I kept the one the existing test suite asserts against, so no test expectations were rewritten to fit the code.

FeeEstimator.tsx

  • load() had two copies of the onFeeLoad guard, the first unclosed.
  • Props declared both compact?: boolean and variant?: "default" | "compact", and the render body had a compact branch wrapping an orphaned variant branch plus a duplicate header/refresh button. Kept the compact API — FeeEstimator.test.tsx renders <FeeEstimator compact /> and asserts the "Base: … · Recommended: …" string, while variant had no tests and no callers.

SorobanPanel.tsx

  • buildCurlCommand was defined twice, the first copy unclosed. Kept the version the tests assert against (https://soroban-rpc.example.com/invoke).
  • The else branch of doInvoke was left unclosed by a trailing fragment of the older single-call implementation.
  • The submit button's nested label ternary had a ? where a : belonged.
  • Removed the now-unused cn import, and a redundant state === "loading" in disabled={!canInvoke || state === "loading"} — TypeScript flags it as unreachable (TS2367) because canInvoke already requires state !== "loading".

SorobanPanel.test.tsx

  • Closed describe("simulate mode"), and completed the truncated "grows the argument textarea…" test to match its name (asserts rows starts at 3, grows to 6 on multi-line input, and keeps resize-y). Removed a dead HISTORY_KEY constant.

Result

Test files Tests Parse errors
main (5bc3678) 24 failed / 51 passed 61 failed / 945 passed (1006) 9
this branch 19 failed / 56 passed 67 failed / 996 passed (1063) 0

5 test files and 57 previously-unrunnable tests are restored. Failures rise 61 → 67 because the recovered files now actually execute; those 6 are real pre-existing failures that the parse errors had been hiding, not regressions.

tsc -b reports zero errors for both repaired files, and ESLint is clean on FeeEstimator.tsx and SorobanPanel.test.tsx.

What this deliberately does not fix

npm run build still does not pass. With the files parsing, tsc -b now surfaces 65 pre-existing type errors across 25 files that were previously masked — mostly unused imports (33 × TS6133), plus missing exports, two wrong icon identifiers in ActivityTimeline.tsx, and duplicate identifiers. That's a repo-wide cleanup overlapping several other open issues, so I've kept this PR to the parse-level damage that was blocking everything.

Two pre-existing ESLint errors also remain in SorobanPanel.tsx (react-hooks/refs at the argsRef.current = args render assignment, and react-hooks/set-state-in-effect in the contractId-reset effect). Both are behavioural changes rather than syntax repair, so they're out of scope here — happy to take them in a follow-up.


Correction: an earlier revision of this description quoted that commit subject verbatim, including its #324. GitHub read it as a closing reference and auto-closed #324 when this PR merged. #324 is unrelated to this repair and is assigned to @sweetsoul21 — it needs reopening, and I do not have permission to do it myself. The reference above is now defanged so it will not recur. Apologies for the noise.

…nPanel

Both files carried two interleaved versions of the same code from botched
conflict resolutions, leaving unclosed blocks. They failed to parse, so
`tsc -b` and `npm run build` aborted and every test file importing them
could not run.

FeeEstimator:
- `load()` had two copies of the onFeeLoad guard, the first unclosed.
- Props declared both `compact` and `variant`; the render body contained a
  `compact` branch wrapping an orphaned `variant` branch plus a duplicate
  header. Kept the `compact` API the existing tests exercise and dropped the
  untested, uncalled `variant` duplicate.

SorobanPanel:
- `buildCurlCommand` was defined twice, the first copy unclosed. Kept the
  version the tests assert against (soroban-rpc.example.com/invoke).
- The `else` branch of `doInvoke` was left unclosed by a trailing fragment
  of the older single-call implementation.
- The submit button's label ternary had a `?` where a `:` belonged.
- Dropped the now-unused `cn` import and a redundant `state === "loading"`
  check that TypeScript proved unreachable via `canInvoke`.

SorobanPanel.test.tsx:
- A truncated test body left `describe("simulate mode")` unclosed. Completed
  the textarea-growth test to match its name and removed a dead constant.

Restores 5 test files and 57 previously unrunnable tests.
@k-deejah
k-deejah merged commit 3079b3a into Sorokit:main Jul 30, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: Badge size prop and dot-only, Input prefix/suffix and warning, FeeEstimator compact variant and onFeeLoad callback

2 participants