Repository navigation
fix(ui): keep Save disabled while an ENS name refetches - #1179
Conversation
CustomAddressModal blocked Save on the ENS query's isLoading, which is false when cached data exists. Re-entering a name resolved earlier let Save commit the cached address while the on-chain refetch was in flight. Block on isFetching instead. Amp-Thread-ID: https://ampcode.com/threads/T-a4a764cb-9d24-4525-9da2-bc80f79e6809
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @pedromcunha-uneven's task in 22s —— View job Code Review -- No issues found. Reviewed 3 files, 31 lines changed. Checked for correctness, security, error handling, and repo guidelines compliance.
|
|
Claude finished @pedromcunha-uneven's task in 14s —— View job 📝 Docs Drift Check: No docs impact This PR doesn't change anything that would need an update in |
[Medium impact] The PR appears safe to merge.
|
Follow-up to #1168, from a CodeRabbit finding on unevenlabs/relay-client#1116.
CustomAddressModalblocked Save on the ENS query'sisLoading. TanStack Query setsisLoadingonly when there is no cached data, so re-entering a name that was resolved earlier in the session showed the cached address with Save enabled while the on-chain refetch was still in flight. If the name's record had changed, Save committed the old address.Changes / decisions to review
isFetchinginstead ofisLoadingfor the ENS lookup inCustomAddressModal. Save stays disabled, and the input shows the spinner, during every ENS fetch, including refetches of a cached name.useENSAddressuses the defaultstaleTimeof 0) also briefly disables Save until the lookup returns. This is intended: Save never commits an address that is being re-checked.CustomAddressModal.test.tsx: resolvevitalik.eth, clear the input, change the registry answer, type the name again, and assert Save is disabled while the RPC reply is held, then that Save commits the refreshed address. It fails onmain("expected disabled true, received false") and passes with this change.@relayprotocol/relay-kit-uipatch.Verification
pnpm vitest runinpackages/ui: 5/5 pass, including the new test. Before the fix, the new test failed at the "disabled while the refetch is pending" assertion.tsc --noEmit(ui),pnpm lintandpnpm lint:changesetspass.