From fbfee48daa919f823a7bf6357c9f696c7e03d94b Mon Sep 17 00:00:00 2001 From: psofiterol Date: Fri, 28 Aug 2026 16:39:39 +0300 Subject: [PATCH] fix(faucet): keep the send-to-address field visible once a wallet connects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It lived only in the `!isConnected` branch, which had two faults. THE VISIBLE ONE. Wallet state rehydrates from localStorage a beat after mount, so anyone with a previously-connected wallet saw the section render and then vanish as `isConnected` flipped to true. It read as the page flashing the new UI and reverting to the old one, and it reproduced in Chromium but not Firefox purely because a wallet was connected in one and not the other. Nothing to do with caching or the deploy, which is where I looked first. THE WORSE ONE. Connected visitors never got the feature at all. Funding an agent's address has nothing to do with whether YOUR wallet is connected, yet only disconnected visitors could see the field — which excludes most returning users, and plausibly most of the people being asked to unblock an agent. Now mounted in both branches, so it cannot disappear and cannot be missed. The divider label adapts: "or" when disconnected, "or send to another address" when connected, where it is a second distinct action rather than an alternative to connecting. Deliberately NOT fixing the top half of the card. `useConnection` exposes `isReconnecting` and a skeleton would suppress the Connect-button flash too, but with `reconnectOnMount` the status passes through `reconnecting` on every load even when nothing is stored — so a skeleton would introduce a flash for visitors who currently get an instant button. That transition is pre-existing and affects all three faucets equally; it wants its own change. fmt --check, typecheck, type-aware lint and build all pass. --- src/app/components/FaucetCard.tsx | 34 +++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/app/components/FaucetCard.tsx b/src/app/components/FaucetCard.tsx index 8a5a38d..5c39e4c 100644 --- a/src/app/components/FaucetCard.tsx +++ b/src/app/components/FaucetCard.tsx @@ -314,6 +314,27 @@ export function FaucetCard(): React.JSX.Element { // the other faucets would promise a payout nothing can make. const canPasteAddress = variant === "blacklight"; + // Rendered in BOTH connection states, on purpose. + // + // It used to live only in the not-connected branch, which had two faults. Wallet state + // rehydrates from localStorage a beat after mount, so anyone with a previously-connected + // wallet watched this section appear and then vanish as `isConnected` flipped — a visible + // flash of the new UI reverting to the old. And more seriously, they never got the feature + // at all: funding an agent's address has nothing to do with whether YOUR wallet is + // connected, but only disconnected visitors could see the field. + const pasteSection = canPasteAddress ? ( + <> +
+ + + {isConnected ? "or send to another address" : "or"} + + +
+ + + ) : null; + if (!isConnected) { return ( @@ -332,17 +353,7 @@ export function FaucetCard(): React.JSX.Element { )} - - {canPasteAddress && ( - <> -
- - or - -
- - - )} + {pasteSection}
); @@ -352,6 +363,7 @@ export function FaucetCard(): React.JSX.Element { {isL2 ? : } + {pasteSection} );