Skip to content

refactor(new-proposal): remove unreachable SubmitStep dead code#21

Merged
sidhujag merged 1 commit intomasterfrom
cleanup/remove-unreachable-submit-step
Apr 24, 2026
Merged

refactor(new-proposal): remove unreachable SubmitStep dead code#21
sidhujag merged 1 commit intomasterfrom
cleanup/remove-unreachable-submit-step

Conversation

@sidhujag
Copy link
Copy Markdown
Member

Summary

After the Codex PR8 round 5 P2 refactor, onPrepare redirects
straight to /governance/proposal/:id — the canonical, reload-safe
status page that already hosts the Pay-with-Pali / syscoin-cli /
OP_RETURN lanes and the attach-collateral form. That made the
in-wizard SubmitStep unreachable: setPrepared(envelope) is
followed immediately by history.replace(nextPath), so
currentStep === 'submit' never renders, and a regression test
already asserts wizard-panel-submit is null post-prepare.

This PR deletes that dead code.

Removed

  • SubmitStep component and its 'submit' entry in STEPS /
    STEP_LABELS.
  • currentStep === 'submit' render branch.
  • Toolbar currentStep !== 'submit' guards (always true now).
  • onAttachCollateral handler — the attach-collateral flow lives on
    the status page (ProposalStatus.js) which has its own handler.
  • txidInput / attaching / attachError state — only consumed by
    SubmitStep.
  • fmtSys local helper — only used inside SubmitStep.
  • Imports no longer referenced: PayWithPaliPanel, usePaliAvailable,
    COLLATERAL_FEE_SATS, HEX64_RE.
  • Doc-header "Four steps: Basics, Payment, Review, Submit" rewritten
    to describe the three reachable steps plus the post-prepare
    redirect.

Kept intentionally

  • prepared state + setPrepared(envelope) — still participates in
    the dirty-guard dirty = !formsEqual(form, baseline) && prepared == null
    that suppresses the unsaved-changes modal during the prepare →
    redirect handoff. Removing it would touch the leave-guard logic
    and is out of scope here.
  • The "why redirect instead of in-wizard submit" comment block on
    onPrepare — historical rationale is still useful context for the
    pre-authorised allowedPathRef navigation.
  • The regression-guard test assertion that wizard-panel-submit
    never mounts post-prepare — now trivially true, but serves as a
    trip-wire if anyone re-adds an in-wizard submit panel without the
    redirect.

PayWithPaliPanel (and usePaliAvailable) remain in the codebase:
still consumed by ProposalStatus.js.

Test plan

  • npm test -- --testPathPattern='pages/NewProposal' — 30 passed
  • npm test -- --testPathPattern='(ProposalStatus|PayWithPaliPanel)' — 39 passed (sanity, unaffected by this change)
  • Manual smoke: draft → Basics → Payment → Review → Prepare →
    should land on /governance/proposal/:id with no unsaved-changes
    modal flash; Back / Save-draft render correctly on every reachable
    step.

Made with Cursor

After Codex PR8 round 5 P2 the prepare flow redirects straight to
/governance/proposal/:id (the canonical, reload-safe status page that
already hosts the Pay-with-Pali / syscoin-cli / OP_RETURN lanes and
the attach-collateral form). The in-wizard SubmitStep has been
unreachable since that refactor — `setPrepared` is followed
immediately by `history.replace`, so `currentStep === 'submit'` never
renders, and a regression test already asserts `wizard-panel-submit`
is null post-prepare.

Drops:
 - SubmitStep component + its 'submit' entry in STEPS / STEP_LABELS
 - currentStep === 'submit' render branch + dead toolbar guards
 - onAttachCollateral handler (logic duplicated on the status page)
 - txidInput / attaching / attachError state (SubmitStep-only)
 - fmtSys local helper (SubmitStep-only)
 - Imports no longer referenced: PayWithPaliPanel, usePaliAvailable,
   COLLATERAL_FEE_SATS, HEX64_RE

Kept:
 - `prepared` state + setPrepared — still participates in the dirty-
   guard (dirty = ... && prepared == null) that suppresses the
   unsaved-changes modal during the prepare → redirect handoff.
 - The existing "why redirect instead of in-wizard submit" comment
   block on onPrepare (historical rationale is still useful).
 - The regression-guard test assertion that wizard-panel-submit
   never mounts (now trivially true, but a trip-wire for anyone
   re-adding an in-wizard submit panel).

No behavior change for any reachable flow; all 30 NewProposal tests
still pass.

Made-with: Cursor
@sidhujag sidhujag merged commit b7c7dc2 into master Apr 24, 2026
5 of 6 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.

1 participant