Frontend: PresaleVestingPage claimError persists across chain switch back to target #166
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:open_issues
agents
agent:security_audit
agent:verify
area
timecurve
arena
arena-v2
audit
block:feature_review
block:security
bug
contracts
design
devops
docs
documentation
enhancement
epic
feature
frontend
indexer
low priority
megaeth
operations
ops
performance
QA
qa checklist
referrals
removal
security
smart-contracts
tech-debt
testing
time-arena
timecurve
visual-qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/yieldomega#166
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
split-out from #106 per @PlasticDigits. live walk on
db00da4PASSed items 1-3, item 4 (clear-on-chain-match) leaves a stale red panel.repro at HEAD
390f9beclaimable > 0, on build target chainclaimErrorrenders red StatusMessage in VOUR WALLET cardclaimGateErrorclears via the chainId useEffectclears today only via F5 reload or successful claim (
resetWrite()onclaimSuccess).why
PresaleVestingPage.tsx:105-109clearsclaimGateErroronly. wagmiclaimError(line 93 destructure, rendered at line 270) has no chain-match clear path — onlyresetWrite()onclaimSuccessat line 98-103.suggested fix
extend the chain-match useEffect to call
resetWrite()whenclaimErroris set and chain matches.resetWritealready destructured at line 93. mirrors the post-success path.severity
P3-low. UX polish, no security/correctness impact. matches parent #106 framing.
acceptance
claimErrorpanel without reloadclaimGateErrorsemantics preserved<ChainMismatchWriteBarrier>+ disabled-button untouchednpm run typecheck+npm testcleanref
parent #106, dev's file separately direction.
mentioned in issue #106
mentioned in commit
fe530bd60cImplemented (GitLab #166)
Merged to
main(c248ec9merge commit): stale wagmiuseWriteContracterroron/vestingnow clears when the wallet transitions wrong chain → build target, by callingreset()only on that transition (same recovery posture asclaimGateError). Same-chain rejects stay visible until retry, successful claim, or another wrong-chain round-trip.Code
shouldResetWriteContractErrorAfterChainTransition—frontend/src/pages/presaleVesting/presaleVestingWriteErrorChainReset.tsusePresaleVestingChainWriteEffects—frontend/src/pages/presaleVesting/usePresaleVestingChainWriteEffects.tspresaleVestingWriteErrorChainReset.test.tsDocs / invariants
INV-FRONTEND-166—docs/testing/invariants-and-business-logic.md§ #166docs/testing/manual-qa-checklists.md(#106 step 4 / #166)docs/frontend/presale-vesting.md,docs/testing/strategy.md,skills/README.md, contributor guardrails skill cross-links.Verification checklist (please confirm)
VITE_CHAIN_ID: red claimError panel clears without reload.claimGateErrorbehavior unchanged (clears when on target).<ChainMismatchWriteBarrier>+ disabled Claim DOUB unchanged.cd frontend && npm run typecheck && npm test -- --runpasses./cc @brouie — requesting verification on the above when you have a moment. Leaving this issue open until you sign off.
@PlasticDigits — source-side verification PASS on
c248ec9(fe530bdimpl).pure helper
shouldResetWriteContractErrorAfterChainTransitionatfrontend/src/pages/presaleVesting/presaleVestingWriteErrorChainReset.ts:12-22— three-condition gate (has error AND previous chain was mismatch AND current chain is target). deliberately does not trigger on first paint, same-wrong-chain, target → wrong, or wrong-A → wrong-B different-id. funneled throughchainMismatchWriteMessageso any future target-predicate change cascades automatically.custom hook
usePresaleVestingChainWriteEffectsat:7-38—prevChainIdRef.currentsnapshot read at:20before being overwritten at:21, dep array at:37correctly includeswriteContractError.walking the checklist:
claimGateErrorbehavior unchanged — PASS. the old useEffect-on-page that clearedclaimGateErrorwhen on target now lives inside the hook at:23-25(if (!chainMismatchWriteMessage(chainId, env)) { setClaimGateError(null); }). manual setClaimGateError(null) on click atPresaleVestingPage.tsx:288and on claimSuccess at:100-106unchanged.<ChainMismatchWriteBarrier>+ disabled Claim DOUB unchanged — PASS. barrier atPresaleVestingPage.tsx:249enclosing wallet panel through:311, button predicate at:276-302matches pre-patch (chainMismatchForWrites || !claimsEnabled || claimable === undefined || claimable === 0n || claimSubmitting || claimConfirming).typecheck + npm test — PASS.
tsc -bclean (no output),vitest run50 files / 295 passed at HEAD284c15c. dedicated#166test filepresaleVestingWriteErrorChainReset.test.ts5/5 PASS in 2ms.wrong chain → reject → switch back to target → red claimError panel clears — live UX walk pending (need MetaMask + Vite session). source path: helper returns
trueon the wrong→target transition withhasWriteContractError === true, hook callsresetWrite(), panel re-renders withoutclaimError.stay-on-target reject → error persists until success / retry / wrong-chain round-trip — live UX walk pending. source path: helper returns
falseon same-target-chain (no transition),resetWrite()is not invoked, panel stays.parking 1 + 2 on the live walk debt list — picking up next laptop session, will post follow-up confirmation. nothing on the source or test side suggests they fail; the gate logic + hook wiring + test coverage all check out.
one nit on test coverage worth folding into a follow-up if useful, otherwise drop:
chainId === 0(disconnected wagmi) — wagmi returns 0 not undefined, currently treated as wrong-chainflagging close-ready on the source side. happy to walk live 1+2 next session.
mentioned in commit
42968aa984