refactor(new-proposal): remove unreachable SubmitStep dead code#21
Merged
refactor(new-proposal): remove unreachable SubmitStep dead code#21
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
After the Codex PR8 round 5 P2 refactor,
onPrepareredirectsstraight to
/governance/proposal/:id— the canonical, reload-safestatus page that already hosts the Pay-with-Pali / syscoin-cli /
OP_RETURN lanes and the attach-collateral form. That made the
in-wizard
SubmitStepunreachable:setPrepared(envelope)isfollowed immediately by
history.replace(nextPath), socurrentStep === 'submit'never renders, and a regression testalready asserts
wizard-panel-submitis null post-prepare.This PR deletes that dead code.
Removed
SubmitStepcomponent and its'submit'entry inSTEPS/STEP_LABELS.currentStep === 'submit'render branch.currentStep !== 'submit'guards (always true now).onAttachCollateralhandler — the attach-collateral flow lives onthe status page (
ProposalStatus.js) which has its own handler.txidInput/attaching/attachErrorstate — only consumed bySubmitStep.fmtSyslocal helper — only used insideSubmitStep.PayWithPaliPanel,usePaliAvailable,COLLATERAL_FEE_SATS,HEX64_RE.to describe the three reachable steps plus the post-prepare
redirect.
Kept intentionally
preparedstate +setPrepared(envelope)— still participates inthe dirty-guard
dirty = !formsEqual(form, baseline) && prepared == nullthat suppresses the unsaved-changes modal during the prepare →
redirect handoff. Removing it would touch the leave-guard logic
and is out of scope here.
onPrepare— historical rationale is still useful context for thepre-authorised
allowedPathRefnavigation.wizard-panel-submitnever 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(andusePaliAvailable) remain in the codebase:still consumed by
ProposalStatus.js.Test plan
npm test -- --testPathPattern='pages/NewProposal'— 30 passednpm test -- --testPathPattern='(ProposalStatus|PayWithPaliPanel)'— 39 passed (sanity, unaffected by this change)should land on
/governance/proposal/:idwith no unsaved-changesmodal flash; Back / Save-draft render correctly on every reachable
step.
Made with Cursor