Skip to content

fix(ui): keep Save disabled while an ENS name refetches - #1179

Merged
pedromcunha-uneven merged 1 commit into
mainfrom
fix-ens-refetch-save
Nov 9, 2026
Merged

pedromcunha-uneven merged 1 commit into
mainfrom
fix-ens-refetch-save

Conversation

@pedromcunha-uneven

Copy link
Copy Markdown
Collaborator

Follow-up to #1168, from a CodeRabbit finding on unevenlabs/relay-client#1116.

CustomAddressModal blocked Save on the ENS query's isLoading. TanStack Query sets isLoading only 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

  • Block on isFetching instead of isLoading for the ENS lookup in CustomAddressModal. Save stays disabled, and the input shows the spinner, during every ENS fetch, including refetches of a cached name.
  • The cached address stays visible during the refetch. It is shown in the "Resolved address" box but cannot be saved until the refetch finishes; once it does, the box updates to the new result. I chose this over clearing the cached value, which would make the box flicker.
  • Side effect: any refetch while the modal is open (for example on window focus, since useENSAddress uses the default staleTime of 0) also briefly disables Save until the lookup returns. This is intended: Save never commits an address that is being re-checked.
  • Regression test in CustomAddressModal.test.tsx: resolve vitalik.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 on main ("expected disabled true, received false") and passes with this change.
  • Changeset: @relayprotocol/relay-kit-ui patch.

Verification

  • pnpm vitest run in packages/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 lint and pnpm lint:changesets pass.

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
@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
relay-sdk-demo Ready Ready Preview Nov 9, 2026 4:00pm UTC

Request Review

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • Switching to isFetching fixes the bug: TanStack Query's isLoading is only true when there is no cached data, so a refetch of a cached name left Save enabled. isFetching is true for every in-flight request, and it feeds into both the Save disabled check (CustomAddressModal.tsx:437) and the spinner.
  • The new test does check the pending state. The shared resolveOnChain() helper holds the RPC reply and asserts disabled === true (CustomAddressModal.test.tsx:160) before releasing it, so the refetch assertion is covered even though it isn't written out in the new test body.
  • The changeset leads with what users see and names the right package.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

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 relayprotocol/relay-docs. It changes how one internal UI component behaves: the recipient address modal now keeps Save disabled while it looks up an ENS name again. No public SDK action, hook, widget prop, provider API, adapter interface or package export changes. The Relay Kit reference docs don't cover the ENS lookup or the recipient address modal.

@greptile-apps

greptile-apps Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

CustomAddressModal now uses isFetching to disable Save during ENS lookups, including refetches with cached results.

  • The recipient-address modal waits for ENS refetches before enabling Save.

Briefly disabling Save during a focus refetch is intentional per pedromcunha-uneven: Save must stay disabled while the address is being checked.

Reviews (1) · Last reviewed commit: "fix(ui): keep Save disabled while an ENS..." · Reviewed by Greptile

@pedromcunha-uneven
pedromcunha-uneven merged commit 0e437fd into main Nov 9, 2026
9 checks passed
@pedromcunha-uneven
pedromcunha-uneven deleted the fix-ens-refetch-save branch November 9, 2026 16:18

This branch was successfully deployed

1 active deployment
Preview — b25e6db9 Deployed Nov 9, 2026 by vercel[bot]
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.

3 participants