Skip to content

React doctor cleanup - #7

Merged
jasspreetbawa13 merged 13 commits into
mainfrom
react-doctor-cleanup
Jul 19, 2026
Merged

React doctor cleanup#7
jasspreetbawa13 merged 13 commits into
mainfrom
react-doctor-cleanup

Conversation

@jasspreetbawa13

Copy link
Copy Markdown
Contributor

No description provided.

Extract source/destination/CTA/engine hooks out of PaySwapIntentWidget
(918 -> 220 lines), share latest-ref/token-pick/ActionButton across flows,
and remove dead code. react-doctor: 111 -> 10 issues.
Modal now uses <dialog> + showModal() for a real focus trap. Remove the
never-imported EVM->Miden bridge path. react-doctor: 10 -> 2.
Move Earn state and SDK wiring into useEarnEngine (1091 -> 245 lines).
Network-scoped choices become one self-evicting value, so a network flip
invalidates them together instead of a 6-setter reset. Share
TokenPickerModal/IntentProgress/GaslessSection across flows.
react-doctor: 2 -> 0.
Break WithdrawDetailPanel (452 -> 157) into withdraw/ subcomponents:
FromCard, AmountCard, SmartWithdrawToggle, SmartWithdrawDestination.
Drop a stale comment and pure-restate comments across the pay/earn files.
Adopt DEPOSIT_EXTRADATA_TYPESTRING / WITHDRAW_EXTRADATA_TYPESTRING (added on
smallocator dev) instead of hand-building the fields. Adds the canonical
`isAll` and drops the stale `simulate` — no solver reads it.
Extract usePropOverride (network/tab self-eviction) and useEffectiveGasless,
shared by both engines. Consolidate the duplicated formatUsd into
lib/format-usd. Remove unused SourcePicker.
showModal() puts the modal in the browser top layer, above any menu portalled
to document.body — so the Smart Withdraw token/chain dropdowns rendered behind
it. Portal dropdown menus into the containing <dialog> instead, and move the
blur scrim off the dialog so it doesn't become a containing block that offsets
their fixed positioning.
Each view rendered a different modal component (TokenPickerModal vs Modal), so
React remounted the <dialog> across the boundary — closing and reopening it,
replaying the open animation. Render one Modal whose content/title/chrome change
with the view, so it stays mounted. Removes the now-unused TokenPickerModal.
Insufficient-balance now compares the entered amount against the funding
source's balance (EVM wallet, Miden wallet, or the position's withdrawable on
withdraw) instead of only flagging a zero balance. The CTA disables and reads
"Insufficient <token> balance", so the intent can't be submitted.
Add MIDEN_CHAIN + getMidenChainTokens (Miden graph faucets shaped as tokens on
the virtual Miden chain) and inject them into the swap source and destination
token lists, so Miden and its tokens appear in the pickers alongside the EVM
chains — no separate tab.

Also folds in the pending miden.ts refactor (SDK-sourced MIDEN_VIRTUAL_CHAIN_ID /
EVM_ZERO_ADDRESS, dropped unused EARN_MIDEN_WITHDRAW_EXTRA_FIELDS), which shared
the file.
@vercel

vercel Bot commented Jul 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
epoch-widget Error Error Jul 19, 2026 1:24am

@github-actions

Copy link
Copy Markdown

React Doctor found 1 new issue in 1 file · 1 warning · score 89 / 100 (Great) · 101 fixed · vs main

1 warning

src/earn/use-earn-engine.ts

  • ⚠️ L352 State adjusted after a prop changes no-adjust-state-on-prop-change

Reviewed by React Doctor for commit b759cf2. See inline comments for fixes.

if (!first) return;
didAutoPickRef.current = true;
selectPosition(first);
setView("withdrawDetail");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/no-adjust-state-on-prop-change (warning)

This effect adjusts state after a prop changes, so users briefly see the stale value.

Fix → Remove the adjustment effect by deriving values during render, resetting the component with a key, or updating related state in the event that changes the prop. Avoid tracking the previous prop in more state, which preserves the duplication. See https://react.dev/learn/you-might-not-need-an-effect#adjusting-some-state-when-a-prop-changes

Docs

@jasspreetbawa13
jasspreetbawa13 merged commit 168c33d into main Jul 19, 2026
3 of 4 checks passed
@jasspreetbawa13
jasspreetbawa13 deleted the react-doctor-cleanup branch July 19, 2026 02:26
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