WIP: Merge ENSApi /api/config endpoint into /api/indexing-status endpoint#1671
WIP: Merge ENSApi /api/config endpoint into /api/indexing-status endpoint#1671
/api/config endpoint into /api/indexing-status endpoint#1671Conversation
Include `config` field of `EnsApiPublicConfig` type.
Merge `/api/config` endpoint into `/api/indexing-status`. The former endpoint got deleted, while the later includes the `config: EnsApiPublicConfig` object in the response.
Use `EnsIndexerClient` to fetch indexing status.
New names will match `EnsApiProvider*` pattern.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
📝 WalkthroughWalkthroughReplaces ENSNode-centric provider/hooks with EnsApi variants, adds Changes
Sequence Diagram(s)sequenceDiagram
rect rgba(200,220,255,0.5)
participant UI as UI Component
participant Hook as useEnsApiConfig
participant Provider as EnsApiProvider
participant SWR as useIndexingStatusWithSwr
participant API as EnsIndexer API
end
UI->>Hook: call useEnsApiConfig()
Hook->>Provider: resolve provider options (useEnsApiProviderOptions)
Hook->>SWR: subscribe (enabled when indexing status is success)
SWR->>API: fetch /indexing-status
API-->>SWR: respond { realtimeProjection, config }
SWR-->>Hook: provide indexingStatus.data (includes config)
Hook-->>UI: return query result containing ensApiPublicConfig
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Consolidates ENSApi metadata fetching by embedding the former /api/config payload into the /api/indexing-status response, and propagates the updated data model through the ENSNode SDK, @ensnode/ensnode-react, and ENSAdmin consumers.
Changes:
- ENSApi
/indexing-statusnow returns{ realtimeProjection, config }and the standalone/configroute is removed. - ENSNode SDK updates indexing-status response types + (de)serialization + Zod schemas to include
config. - ENSNode React + ENSAdmin update provider/options naming and migrate config consumption to come from indexing-status.
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/namehash-ui/src/components/identity/ResolveAndDisplayIdentity.tsx | Passes namespace explicitly into useResolvedIdentity. |
| packages/ensnode-sdk/src/ensapi/config/deserialize.ts | Exposes config unvalidated builder for reuse by indexing-status deserializer. |
| packages/ensnode-sdk/src/ensapi/api/indexing-status/zod-schemas.ts | Adds config to OK schema + serialized OK schema. |
| packages/ensnode-sdk/src/ensapi/api/indexing-status/serialized-response.ts | Adds serialized config to serialized OK response type. |
| packages/ensnode-sdk/src/ensapi/api/indexing-status/serialize.ts | Serializes config into indexing-status OK responses. |
| packages/ensnode-sdk/src/ensapi/api/indexing-status/response.ts | Adds config: EnsApiPublicConfig to indexing-status OK response type. |
| packages/ensnode-sdk/src/ensapi/api/indexing-status/deserialize.ts | Deserializes config from the indexing-status response. |
| packages/ensnode-react/src/utils/query.ts | Switches to EnsApiClient + removes separate config query helpers/keys. |
| packages/ensnode-react/src/types.ts | Renames provider config types to EnsApi-oriented types and adds namespace param to resolved-identity hook params. |
| packages/ensnode-react/src/provider.tsx | Renames provider to EnsApiProvider and helper to createEnsApiOptions. |
| packages/ensnode-react/src/hooks/useResolvedIdentity.ts | Stops deriving namespace from config fetch; accepts namespace directly. |
| packages/ensnode-react/src/hooks/useRegistrarActions.ts | Migrates hooks to use provider “options” via useEnsApiProviderOptions. |
| packages/ensnode-react/src/hooks/useRecords.ts | Migrates hooks to use provider “options” via useEnsApiProviderOptions. |
| packages/ensnode-react/src/hooks/usePrimaryNames.ts | Migrates hooks to use provider “options” via useEnsApiProviderOptions. |
| packages/ensnode-react/src/hooks/usePrimaryName.ts | Migrates hooks to use provider “options” via useEnsApiProviderOptions. |
| packages/ensnode-react/src/hooks/useNameTokens.ts | Migrates hooks to use provider “options” via useEnsApiProviderOptions. |
| packages/ensnode-react/src/hooks/useIndexingStatus.ts | Updates request/response types to EnsApi-prefixed indexing-status types. |
| packages/ensnode-react/src/hooks/useEnsApiProviderOptions.ts | New hook replacing useENSNodeSDKConfig for resolving provider options. |
| packages/ensnode-react/src/hooks/useENSNodeSDKConfig.ts | Removed legacy config hook. |
| packages/ensnode-react/src/hooks/useENSNodeConfig.ts | Removed legacy config-fetch hook. |
| packages/ensnode-react/src/hooks/index.ts | Updates public hook exports to new options hook. |
| packages/ensnode-react/src/context.ts | Renames context to EnsApiContext and updates types. |
| packages/ensnode-react/README.md | Updates docs/examples for new provider/options naming (incomplete). |
| apps/ensapi/src/handlers/ensnode-api.ts | Removes /config endpoint and injects config into /indexing-status responses. |
| apps/ensapi/src/cache/indexing-status.cache.ts | Updates ENSApi’s ENSIndexer client usage/type names. |
| apps/ensadmin/src/hooks/async/use-namespace.ts | Switches namespace derivation to new ENSApi config hook. |
| apps/ensadmin/src/hooks/active/use-active-connection.tsx | Uses new ENSApi config hook for active connection invariant. |
| apps/ensadmin/src/components/registrar-actions/use-stateful-fetch-registrar-actions.ts | Uses indexing-status’ embedded config to gate registrar actions support. |
| apps/ensadmin/src/components/providers/selected-ensnode-provider.tsx | Migrates selected connection provider to EnsApiProvider + createEnsApiOptions. |
| apps/ensadmin/src/components/layout-wrapper.tsx | Updates layout to use renamed selected provider component. |
| apps/ensadmin/src/components/indexing-status/use-indexing-status-with-swr.ts | SWR caching updated to cache both snapshot + config and reproject over time. |
| apps/ensadmin/src/components/connections/require-active-connection.tsx | Uses ENSApi config hook and updates user-facing error copy. |
| apps/ensadmin/src/components/connection/cards/ensnode-info.tsx | Migrates config display to new ENSApi config hook and updated types. |
| apps/ensadmin/src/components/config/useEnsApiConfig.ts | New hook to expose config from indexing-status-derived data. |
Comments suppressed due to low confidence (2)
packages/ensnode-sdk/src/ensapi/api/indexing-status/zod-schemas.ts:17
- The type imports from
./responseand./serialized-responseare unused in this module (they're only referenced in JSDoc). With Biome's recommended rules enabled, this will fail lint due to unused imports; remove these imports or use them in code (e.g., viasatisfieswhere appropriate).
apps/ensapi/src/handlers/ensnode-api.ts:29 - This route now returns both indexing status and the ENSApi public config (via the new
configfield), but the OpenAPIsummary/descriptionstill describe it as only returning an indexing status snapshot from ENSIndexer. Update these strings to reflect the new combined payload so generated docs stay accurate.
describeRoute({
tags: ["Meta"],
summary: "Get ENSIndexer Indexing Status",
description: "Returns the indexing status snapshot most recently captured from ENSIndexer",
responses: {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return useQuery({ | ||
| enabled: indexingStatus.isSuccess, | ||
| queryKey: ["swr", ensApiProviderOptions.client.url.href, "config"], | ||
| queryFn: async () => indexingStatus.data?.config, // enabled flag ensures this is only called when indexingStatus.data is available |
There was a problem hiding this comment.
queryFn can currently return undefined because of the optional chain (indexingStatus.data?.config). Since enabled gates on indexingStatus.isSuccess, you can (and should) return indexingStatus.data.config directly (or throw if unexpectedly missing) to keep the query typed as always returning a config object.
| queryFn: async () => indexingStatus.data?.config, // enabled flag ensures this is only called when indexingStatus.data is available | |
| queryFn: async () => { | |
| if (!indexingStatus.data || !indexingStatus.data.config) { | |
| throw new Error("Indexing status config is unavailable despite isSuccess being true."); | |
| } | |
| return indexingStatus.data.config; | |
| }, |
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (9)
packages/ensnode-sdk/src/ensapi/config/deserialize.ts (1)
12-19:⚠️ Potential issue | 🟡 MinorRemove redundant JSDoc return tag.
The summary already covers the return value.
🧹 Suggested change
- * `@return` An unvalidated {`@link` EnsApiPublicConfig} object.As per coding guidelines: Do not add JSDoc
@returnstags that merely restate the method summary; remove redundancy during PR review.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ensnode-sdk/src/ensapi/config/deserialize.ts` around lines 12 - 19, Remove the redundant JSDoc `@return/`@returns tag from the comment block above buildUnvalidatedEnsApiPublicConfig; keep the existing summary and `@param` description but delete the line that restates the return value so the documentation is not duplicative.packages/ensnode-react/README.md (2)
127-143:⚠️ Potential issue | 🟡 MinorUpdate API reference to use
optionsand EnsApi types.The interface and props list still reference
config/ENSNodeConfig, which no longer match the EnsApiProvider surface.✏️ Suggested doc update
- The provider component that supplies ENSNode configuration to all child components. + The provider component that supplies EnsApi provider options to all child components. interface EnsApiProviderProps { - config: ENSNodeConfig; + options: EnsApiProviderOptions; queryClient?: QueryClient; queryClientOptions?: QueryClientOptions; } - `config`: ENSNode configuration object + `options`: EnsApi provider options🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ensnode-react/README.md` around lines 127 - 143, Update the EnsApiProvider API docs to match the new surface: replace references to the old EnsApiProviderProps/config/ENSNodeConfig with the current props using options and EnsApi types; specifically, document the props as something like options: EnsApiOptions (or options) and api?: EnsApi (or api) / queryClient? / queryClientOptions? as applicable to the actual component signature, and update the Props list bullets to reference options and EnsApi types instead of config/ENSNodeConfig so the README aligns with the EnsApiProvider implementation.
233-251:⚠️ Potential issue | 🟡 MinorAdvanced usage snippets still pass
config; switch tooptions.These examples should mirror the new provider API.
✏️ Suggested doc update
-<EnsApiProvider - config={config} +<EnsApiProvider + options={options} queryClientOptions={{ defaultOptions: { queries: { staleTime: 1000 * 60 * 10, // 10 minutes gcTime: 1000 * 60 * 60, // 1 hour retry: 5, }, }, }} > <App /> </EnsApiProvider> ... - <EnsApiProvider config={config} queryClient={queryClient}> + <EnsApiProvider options={options} queryClient={queryClient}> <App /> </EnsApiProvider>Also applies to: 271-274
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ensnode-react/README.md` around lines 233 - 251, The README examples use the old prop name `config` for EnsApiProvider; update them to use the new `options` prop instead. Find the EnsApiProvider usage examples (including the snippet that mirrors advanced usage and the later similar snippet) and replace `config={config}` with `options={options}` (and update any variable names or surrounding text to match `options` if necessary) so the docs reflect the new provider API.packages/ensnode-react/src/hooks/usePrimaryName.ts (1)
15-16:⚠️ Potential issue | 🟡 MinorRemove redundant JSDoc return tag.
The summary already explains what the hook returns.
🧹 Suggested change
- * `@returns` Query result with resolved primary nameAs per coding guidelines: Do not add JSDoc
@returnstags that merely restate the method summary; remove redundancy during PR review.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ensnode-react/src/hooks/usePrimaryName.ts` around lines 15 - 16, The JSDoc for the usePrimaryName hook contains a redundant `@returns` tag that restates the summary; edit the JSDoc above the usePrimaryName function in packages/ensnode-react/src/hooks/usePrimaryName.ts and remove the `@returns` line so only the descriptive summary remains, leaving parameter tags (e.g., `@param` parameters) intact.packages/ensnode-react/src/hooks/useResolvedIdentity.ts (1)
26-27:⚠️ Potential issue | 🟡 MinorAlign JSDoc param name with
namespace.The docs still reference
namespaceId.✏️ Suggested doc fix
- * `@param` parameters.namespaceId - The {`@link` ENSNamespaceId} that `identity.chainId` should be interpreted + * `@param` parameters.namespace - The {`@link` ENSNamespaceId} that `identity.chainId` should be interpretedAlso applies to: 41-41
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ensnode-react/src/hooks/useResolvedIdentity.ts` around lines 26 - 27, Update the JSDoc for useResolvedIdentity to use the correct parameter name "namespace" (not "namespaceId"); locate the docblocks mentioning "parameters.namespaceId" (around the comment for getResolvePrimaryNameChainIdParam usage) and replace them with "parameters.namespace" so the param name aligns with the actual function signature and do the same for the second occurrence referenced at line ~41.packages/ensnode-react/src/provider.tsx (1)
97-106: 🧹 Nitpick | 🔵 TrivialMinor:
EnsApiClient.defaultOptions()called twice.Both the URL fallback and the spread invoke
defaultOptions(). Consider calling it once:♻️ Suggested refactor
export function createEnsApiOptions(options?: { url?: string | URL }): EnsApiProviderOptions { + const defaults = EnsApiClient.defaultOptions(); - const url = options?.url ? new URL(options.url) : EnsApiClient.defaultOptions().url; + const url = options?.url ? new URL(options.url) : defaults.url; return { client: { - ...EnsApiClient.defaultOptions(), + ...defaults, url, }, }; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ensnode-react/src/provider.tsx` around lines 97 - 106, createEnsApiOptions calls EnsApiClient.defaultOptions() twice; assign the result to a local variable (e.g., defaults = EnsApiClient.defaultOptions()), use defaults.url as the fallback when building url (options?.url ? new URL(options.url) : defaults.url), and then spread defaults into the returned client ({ ...defaults, url }) so defaultOptions is invoked only once; update the function createEnsApiOptions accordingly.packages/ensnode-sdk/src/ensapi/api/indexing-status/deserialize.ts (1)
27-33:⚠️ Potential issue | 🟠 MajorOk responses missing
configwill now fail deserialization.Test fixtures in
client.test.ts(lines 142–143 and 200–201) omit theconfigfield despite being typed asSerializedEnsApiIndexingStatusResponseOk. Since the serialized schema requiresconfig, deserializing these fixtures will throw an error. Either addconfigto all existing Ok response payloads/fixtures, or make the field optional in the serialized schema if backward compatibility is required.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ensnode-sdk/src/ensapi/api/indexing-status/deserialize.ts` around lines 27 - 33, The deserializer assumes serializedResponse.config always exists and will throw for existing test fixtures missing config (type SerializedEnsApiIndexingStatusResponseOk). Fix by making config optional at deserialization: in deserialize.ts check for serializedResponse.config and only call buildUnvalidatedEnsApiPublicConfig when present (e.g., config: serializedResponse.config ? buildUnvalidatedEnsApiPublicConfig(serializedResponse.config) : undefined), and update the serialized type (SerializedEnsApiIndexingStatusResponseOk) or schema to mark config as optional for backward compatibility; alternatively, add the missing config objects to the test fixtures in client.test.ts to match the required schema.apps/ensadmin/src/hooks/active/use-active-connection.tsx (1)
5-17:⚠️ Potential issue | 🟡 MinorStale
@returnsqualifier after the hook migration.
useEnsApiConfig().dataisEnsApiPublicConfig— which includesversionandtheGraphFallbackin addition toensIndexerPublicConfig. The parenthetical(currently only the ENSIndexer config)is now inaccurate and should be updated (or removed per the guideline against redundant@returnstags).✏️ Suggested update
- * `@returns` The active ENSNode connection (currently only the ENSIndexer config) + * `@returns` The active ENSApi public configuration (version, theGraphFallback, ensIndexerPublicConfig)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/ensadmin/src/hooks/active/use-active-connection.tsx` around lines 5 - 17, The JSDoc `@returns` is stale: update the comment for the hook (use-active-connection / the hook that returns useEnsApiConfig().data) so it accurately describes that the hook returns an EnsApiPublicConfig (including version and theGraphFallback as well as ensIndexerPublicConfig) instead of saying "(currently only the ENSIndexer config)"; either remove the parenthetical or replace it with a concise phrase like "includes version, theGraphFallback, and ensIndexerPublicConfig" and ensure the `@returns` line matches the actual returned type from useEnsApiConfig().data.packages/ensnode-react/src/utils/query.ts (1)
69-165: 🧹 Nitpick | 🔵 TrivialOptional: rename
configparameter tooptionsacross all query builder functions.The parameter was named
configwhen the type wasENSNodeSDKConfig, but now it'sEnsApiProviderOptions. Keeping the old name is mildly confusing — hook callers consistently name the same valueproviderOptions, while the builders call itconfig. Renaming tooptionshere would close that gap.♻️ Example diff (applies to all seven builder functions)
export function createRecordsQueryOptions<SELECTION extends ResolverRecordsSelection>( - config: EnsApiProviderOptions, + options: EnsApiProviderOptions, args: ResolveRecordsRequest<SELECTION>, ) { return { enabled: true, - queryKey: queryKeys.records(config.client.url.href, args), + queryKey: queryKeys.records(options.client.url.href, args), queryFn: async () => { - const client = new EnsApiClient(config.client); + const client = new EnsApiClient(options.client); return client.resolveRecords(args.name, args.selection, args); }, }; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ensnode-react/src/utils/query.ts` around lines 69 - 165, Rename the parameter named config to options in all query builder functions (createRecordsQueryOptions, createPrimaryNameQueryOptions, createPrimaryNamesQueryOptions, createIndexingStatusQueryOptions, createRegistrarActionsQueryOptions, createNameTokensQueryOptions), update its type to EnsApiProviderOptions where declared, and replace all usages of config.* with options.* (e.g., queryKeys.*(options.client.url.href, ...), new EnsApiClient(options.client), etc.) so the parameter name aligns with callers using providerOptions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/ensadmin/src/components/providers/selected-ensnode-provider.tsx`:
- Around line 24-27: The options object passed to EnsApiProvider is recreated on
every render because createEnsApiOptions(...) is called directly; wrap the call
in React's useMemo (in the SelectedEnsNodeProvider component) keyed on
selectedConnection.validatedSelectedConnection.url so the options object is
stable and the EnsApiInternalProvider's useMemo can work as intended; ensure you
import useMemo and use the memoized value (options) when rendering
<EnsApiProvider options={options}>{children}</EnsApiProvider>.
In `@packages/ensnode-react/src/hooks/useEnsApiProviderOptions.ts`:
- Around line 8-13: Remove the redundant/misleading JSDoc `@returns` tag from the
useEnsApiProviderOptions hook comment block; update the JSDoc above function
useEnsApiProviderOptions to keep the summary and `@param/`@throws if needed but
delete the `@returns` line (which redundantly repeats the summary and references
ENSNode) so the documentation is concise and accurate.
In `@packages/ensnode-react/src/hooks/useRecords.ts`:
- Around line 56-57: The hook useRecords uses the variable name _config for the
result of useEnsApiProviderOptions, which is inconsistent with sibling hooks
usePrimaryNames and useRegistrarActions that name this providerOptions; rename
_config to providerOptions in useRecords and update all its usages (the variable
returned from useEnsApiProviderOptions and any subsequent references) so the
hook consistently uses providerOptions like the others.
In `@packages/ensnode-react/src/provider.tsx`:
- Around line 36-37: The useMemo call in provider.tsx (const memoizedOptions =
useMemo(() => options, [options])) is a no-op because it only tracks the object
reference; fix by making the memo depend on stable primitive values or move the
memoization upstream in SelectedEnsApiProvider: either compute memoizedOptions
from the specific option fields (e.g., name, url, networkId) so useMemo
stabilizes on primitives, or in SelectedEnsApiProvider wrap
createEnsApiOptions(...) in useMemo with a dependency array of the underlying
primitive inputs passed to createEnsApiOptions; update any references to
memoizedOptions accordingly.
In `@packages/ensnode-react/src/types.ts`:
- Around line 17-23: Update the outdated JSDoc comments in this file to
reference the renamed symbols (EnsApi/options) instead of ENSNode/config: change
the top comment for the EnsApiProviderOptions interface to mention
EnsApi/options and update the inline comment for the client property to
reference EnsApiClientOptions/EnsApi options; also make the same updates for the
similar comments around lines 33-38 that reference the old ENSNode/config naming
so all documentation matches the renamed types.
In `@packages/ensnode-sdk/src/ensapi/api/indexing-status/zod-schemas.ts`:
- Around line 64-68: The serialized Ok response schema currently uses z.object
which allows unknown keys; make it consistent with
makeEnsApiIndexingStatusResponseOkSchema and the error schema by changing
z.object({...}) to z.strictObject({...}) around the response (or, if the
relaxation is intentional, add a clarifying comment explaining why extra keys
must be allowed), and ensure the same pattern is applied where
makeSerializedRealtimeIndexingStatusProjectionSchema and
makeSerializedEnsApiPublicConfigSchema are composed so unknown keys are rejected
unless explicitly intended.
---
Outside diff comments:
In `@apps/ensadmin/src/hooks/active/use-active-connection.tsx`:
- Around line 5-17: The JSDoc `@returns` is stale: update the comment for the hook
(use-active-connection / the hook that returns useEnsApiConfig().data) so it
accurately describes that the hook returns an EnsApiPublicConfig (including
version and theGraphFallback as well as ensIndexerPublicConfig) instead of
saying "(currently only the ENSIndexer config)"; either remove the parenthetical
or replace it with a concise phrase like "includes version, theGraphFallback,
and ensIndexerPublicConfig" and ensure the `@returns` line matches the actual
returned type from useEnsApiConfig().data.
In `@packages/ensnode-react/README.md`:
- Around line 127-143: Update the EnsApiProvider API docs to match the new
surface: replace references to the old EnsApiProviderProps/config/ENSNodeConfig
with the current props using options and EnsApi types; specifically, document
the props as something like options: EnsApiOptions (or options) and api?: EnsApi
(or api) / queryClient? / queryClientOptions? as applicable to the actual
component signature, and update the Props list bullets to reference options and
EnsApi types instead of config/ENSNodeConfig so the README aligns with the
EnsApiProvider implementation.
- Around line 233-251: The README examples use the old prop name `config` for
EnsApiProvider; update them to use the new `options` prop instead. Find the
EnsApiProvider usage examples (including the snippet that mirrors advanced usage
and the later similar snippet) and replace `config={config}` with
`options={options}` (and update any variable names or surrounding text to match
`options` if necessary) so the docs reflect the new provider API.
In `@packages/ensnode-react/src/hooks/usePrimaryName.ts`:
- Around line 15-16: The JSDoc for the usePrimaryName hook contains a redundant
`@returns` tag that restates the summary; edit the JSDoc above the usePrimaryName
function in packages/ensnode-react/src/hooks/usePrimaryName.ts and remove the
`@returns` line so only the descriptive summary remains, leaving parameter tags
(e.g., `@param` parameters) intact.
In `@packages/ensnode-react/src/hooks/useResolvedIdentity.ts`:
- Around line 26-27: Update the JSDoc for useResolvedIdentity to use the correct
parameter name "namespace" (not "namespaceId"); locate the docblocks mentioning
"parameters.namespaceId" (around the comment for
getResolvePrimaryNameChainIdParam usage) and replace them with
"parameters.namespace" so the param name aligns with the actual function
signature and do the same for the second occurrence referenced at line ~41.
In `@packages/ensnode-react/src/provider.tsx`:
- Around line 97-106: createEnsApiOptions calls EnsApiClient.defaultOptions()
twice; assign the result to a local variable (e.g., defaults =
EnsApiClient.defaultOptions()), use defaults.url as the fallback when building
url (options?.url ? new URL(options.url) : defaults.url), and then spread
defaults into the returned client ({ ...defaults, url }) so defaultOptions is
invoked only once; update the function createEnsApiOptions accordingly.
In `@packages/ensnode-react/src/utils/query.ts`:
- Around line 69-165: Rename the parameter named config to options in all query
builder functions (createRecordsQueryOptions, createPrimaryNameQueryOptions,
createPrimaryNamesQueryOptions, createIndexingStatusQueryOptions,
createRegistrarActionsQueryOptions, createNameTokensQueryOptions), update its
type to EnsApiProviderOptions where declared, and replace all usages of config.*
with options.* (e.g., queryKeys.*(options.client.url.href, ...), new
EnsApiClient(options.client), etc.) so the parameter name aligns with callers
using providerOptions.
In `@packages/ensnode-sdk/src/ensapi/api/indexing-status/deserialize.ts`:
- Around line 27-33: The deserializer assumes serializedResponse.config always
exists and will throw for existing test fixtures missing config (type
SerializedEnsApiIndexingStatusResponseOk). Fix by making config optional at
deserialization: in deserialize.ts check for serializedResponse.config and only
call buildUnvalidatedEnsApiPublicConfig when present (e.g., config:
serializedResponse.config ?
buildUnvalidatedEnsApiPublicConfig(serializedResponse.config) : undefined), and
update the serialized type (SerializedEnsApiIndexingStatusResponseOk) or schema
to mark config as optional for backward compatibility; alternatively, add the
missing config objects to the test fixtures in client.test.ts to match the
required schema.
In `@packages/ensnode-sdk/src/ensapi/config/deserialize.ts`:
- Around line 12-19: Remove the redundant JSDoc `@return/`@returns tag from the
comment block above buildUnvalidatedEnsApiPublicConfig; keep the existing
summary and `@param` description but delete the line that restates the return
value so the documentation is not duplicative.
ℹ️ Review info
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (34)
apps/ensadmin/src/components/config/useEnsApiConfig.tsapps/ensadmin/src/components/connection/cards/ensnode-info.tsxapps/ensadmin/src/components/connections/require-active-connection.tsxapps/ensadmin/src/components/indexing-status/use-indexing-status-with-swr.tsapps/ensadmin/src/components/layout-wrapper.tsxapps/ensadmin/src/components/providers/selected-ensnode-provider.tsxapps/ensadmin/src/components/registrar-actions/use-stateful-fetch-registrar-actions.tsapps/ensadmin/src/hooks/active/use-active-connection.tsxapps/ensadmin/src/hooks/async/use-namespace.tsapps/ensapi/src/cache/indexing-status.cache.tsapps/ensapi/src/handlers/ensnode-api.tspackages/ensnode-react/README.mdpackages/ensnode-react/src/context.tspackages/ensnode-react/src/hooks/index.tspackages/ensnode-react/src/hooks/useENSNodeConfig.tspackages/ensnode-react/src/hooks/useENSNodeSDKConfig.tspackages/ensnode-react/src/hooks/useEnsApiProviderOptions.tspackages/ensnode-react/src/hooks/useIndexingStatus.tspackages/ensnode-react/src/hooks/useNameTokens.tspackages/ensnode-react/src/hooks/usePrimaryName.tspackages/ensnode-react/src/hooks/usePrimaryNames.tspackages/ensnode-react/src/hooks/useRecords.tspackages/ensnode-react/src/hooks/useRegistrarActions.tspackages/ensnode-react/src/hooks/useResolvedIdentity.tspackages/ensnode-react/src/provider.tsxpackages/ensnode-react/src/types.tspackages/ensnode-react/src/utils/query.tspackages/ensnode-sdk/src/ensapi/api/indexing-status/deserialize.tspackages/ensnode-sdk/src/ensapi/api/indexing-status/response.tspackages/ensnode-sdk/src/ensapi/api/indexing-status/serialize.tspackages/ensnode-sdk/src/ensapi/api/indexing-status/serialized-response.tspackages/ensnode-sdk/src/ensapi/api/indexing-status/zod-schemas.tspackages/ensnode-sdk/src/ensapi/config/deserialize.tspackages/namehash-ui/src/components/identity/ResolveAndDisplayIdentity.tsx
💤 Files with no reviewable changes (2)
- packages/ensnode-react/src/hooks/useENSNodeSDKConfig.ts
- packages/ensnode-react/src/hooks/useENSNodeConfig.ts
apps/ensadmin/src/components/providers/selected-ensnode-provider.tsx
Outdated
Show resolved
Hide resolved
|
apps/ensadmin/src/components/providers/selected-ensnode-provider.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
This file replaces packages/ensnode-react/src/hooks/useENSNodeSDKConfig.ts.
There was a problem hiding this comment.
Replaced with packages/ensnode-react/src/hooks/useEnsApiProviderOptions.ts.
| /** | ||
| * Creates query options for ENSNode Config API | ||
| */ | ||
| export function createConfigQueryOptions(config: ENSNodeSDKConfig) { | ||
| return { | ||
| enabled: true, | ||
| queryKey: queryKeys.config(config.client.url.href), | ||
| queryFn: async () => { | ||
| const client = new ENSNodeClient(config.client); | ||
| return client.config(); | ||
| }, | ||
| }; | ||
| } |
There was a problem hiding this comment.
Config endpoint has been merged into the Indexing Status endpoint, so we don't need a separate query for it.
|
@greptile review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 39 out of 39 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (2)
apps/ensadmin/src/app/mock/indexing-stats/page.tsx:14
CrossChainIndexingStatusSnapshotis imported but no longer used after changingfetchMockedIndexingStatusto return the full response object. This unused import will fail Biome lint; remove it.
import {
CrossChainIndexingStatusSnapshot,
createRealtimeIndexingStatusProjection,
EnsApiIndexingStatusResponseOk,
IndexingStatusResponseCodes,
IndexingStatusResponseOk,
OmnichainIndexingStatusIds,
} from "@ensnode/ensnode-sdk";
packages/ensnode-react/README.md:141
- The README's API reference still documents
EnsApiProviderPropsas taking aconfigprop and usesENSNodeConfigtypes, but the implementation now expectsoptions: EnsApiProviderOptions. This will mislead consumers—update the interface snippet and props list to reflect the newoptionsprop and correct type names.
### EnsApiProvider
The provider component that supplies ENSNode configuration to all child components.
```tsx
interface EnsApiProviderProps {
config: ENSNodeConfig;
queryClient?: QueryClient;
queryClientOptions?: QueryClientOptions;
}
Props
config: ENSNode configuration object
</details>
---
💡 <a href="/namehash/ensnode/new/main?filename=.github/instructions/*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.
| import { | ||
| createIndexingStatusQueryOptions, | ||
| QueryParameter, | ||
| useENSNodeSDKConfig, | ||
| useEnsApiProviderOptions, | ||
| type useIndexingStatus, | ||
| useSwrQuery, | ||
| WithSDKConfigParameter, | ||
| WithEnsApiProviderOptions, | ||
| } from "@ensnode/ensnode-react"; |
There was a problem hiding this comment.
type useIndexingStatus is imported but never referenced in a type position (it only appears in a JSDoc {@link ...}), which will trip Biome's unused-imports rule. Remove this import (or reference a real type) to keep lint passing.
| export type EnsApiIndexingStatusResponseOk = { | ||
| responseCode: typeof EnsApiIndexingStatusResponseCodes.Ok; | ||
| realtimeProjection: RealtimeIndexingStatusProjection; | ||
| config: EnsApiPublicConfig; | ||
| }; |
There was a problem hiding this comment.
The PR/issue description mentions adding an ensApiPublicConfig field to the indexing-status OK response, but the SDK type introduces the field as config. If the intended public API field name is ensApiPublicConfig, this should be renamed for consistency (or the PR/issue description and downstream clients should be updated to match config).
Greptile SummaryThis PR consolidates ENSApi endpoints by merging Key Changes:
Critical Issues Found:
Architecture: Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as React Component
participant Hook as useEnsApiConfig
participant IndexingHook as useIndexingStatusWithSwr
participant API as ENSApi Server
Note over Client,API: Before: Two separate API calls
Client->>API: GET /api/config
API-->>Client: Config data
Client->>API: GET /api/indexing-status
API-->>Client: Indexing status
Note over Client,API: After: Single consolidated call
Client->>IndexingHook: Fetch indexing status
IndexingHook->>API: GET /api/indexing-status
API->>API: buildEnsApiPublicConfig()
API-->>IndexingHook: {realtimeProjection, config}
IndexingHook-->>IndexingHook: Cache both snapshot + config
Client->>Hook: Get config
Hook->>IndexingHook: Read indexingStatus.data?.config
IndexingHook-->>Hook: config from cached data
Hook-->>Client: Config data
Last reviewed commit: 073f642 |
This will address the usecase previously served by `useENSNodeConfig` (that got just removed).
…ublicConfig` value.
…Swr` to just `useIndexingStatusWithSwr` `useIndexingStatusWithSwr` returns `data.config` object with is the cached `EnsApiPublicConfig` value.
…tedEnsApiProvider`
…ith-indexing-status
c53e716 to
ad3f6d5
Compare
Change memoization level for ENSApi options object
ad3f6d5 to
073f642
Compare
|
@greptile review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 40 out of 40 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (selectedConnection.validatedSelectedConnection.isValid) { | ||
| return ( | ||
| <ENSNodeProvider | ||
| config={{ client: { url: selectedConnection.validatedSelectedConnection.url } }} | ||
| > | ||
| {children} | ||
| </ENSNodeProvider> | ||
| const selectedConenctionUrl = selectedConnection.validatedSelectedConnection.url; | ||
| const options = useMemo( | ||
| () => | ||
| createEnsApiOptions({ | ||
| url: selectedConenctionUrl, | ||
| }), | ||
| [selectedConenctionUrl], | ||
| ); |
There was a problem hiding this comment.
useMemo is called inside a conditional branch (if (…isValid)), which violates the Rules of Hooks and can break at runtime when the condition changes between renders. Move the useMemo call to the top level of the component (compute options from a url variable) and only conditionally render EnsApiProvider based on validity.
| const selectedConenctionUrl = selectedConnection.validatedSelectedConnection.url; | ||
| const options = useMemo( | ||
| () => | ||
| createEnsApiOptions({ | ||
| url: selectedConenctionUrl, | ||
| }), | ||
| [selectedConenctionUrl], |
There was a problem hiding this comment.
Typo in variable name selectedConenctionUrl (extra 'en'). Rename to selectedConnectionUrl for clarity and to avoid propagating misspellings.
| const selectedConenctionUrl = selectedConnection.validatedSelectedConnection.url; | |
| const options = useMemo( | |
| () => | |
| createEnsApiOptions({ | |
| url: selectedConenctionUrl, | |
| }), | |
| [selectedConenctionUrl], | |
| const selectedConnectionUrl = selectedConnection.validatedSelectedConnection.url; | |
| const options = useMemo( | |
| () => | |
| createEnsApiOptions({ | |
| url: selectedConnectionUrl, | |
| }), | |
| [selectedConnectionUrl], |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/ensadmin/src/app/mock/indexing-stats/page.tsx (1)
53-57: 🧹 Nitpick | 🔵 TrivialRemove the assertion to preserve compile-time shape checks.
as IndexingStatusResponseOkcan hide fixture drift (especially missingconfig). Prefer explicit typed assignment toEnsApiIndexingStatusResponseOk.Proposed refactor
- const response = indexingStatusResponseOkOmnichain[ - selectedVariant - ] as IndexingStatusResponseOk; + const response: EnsApiIndexingStatusResponseOk = + indexingStatusResponseOkOmnichain[selectedVariant]; return response;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/ensadmin/src/app/mock/indexing-stats/page.tsx` around lines 53 - 57, Remove the type assertion on the fixture and instead explicitly type the variable so TypeScript enforces the full shape: replace the usage of "as IndexingStatusResponseOk" when assigning to response from indexingStatusResponseOkOmnichain[selectedVariant] with an explicit declaration of response as EnsApiIndexingStatusResponseOk; this preserves compile-time checks (so missing fields like config are caught) and keeps selectedVariant and indexingStatusResponseOkOmnichain usage the same.
♻️ Duplicate comments (4)
packages/ensnode-react/src/hooks/useRecords.ts (1)
57-63: 🧹 Nitpick | 🔵 TrivialConsider renaming
_configtoproviderOptionsfor consistency.The hook now works with options terminology; this local name still reflects the old config naming.
♻️ Suggested rename
- const _config = useEnsApiProviderOptions(options); + const providerOptions = useEnsApiProviderOptions(options); @@ - ? createRecordsQueryOptions(_config, { ...args, name }) + ? createRecordsQueryOptions(providerOptions, { ...args, name })🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ensnode-react/src/hooks/useRecords.ts` around lines 57 - 63, Rename the local variable _config to providerOptions for consistency with the options terminology: update the declaration that assigns useEnsApiProviderOptions(options) from const _config = useEnsApiProviderOptions(options); to const providerOptions = useEnsApiProviderOptions(options); and then replace all uses of _config (e.g., in the call to createRecordsQueryOptions(providerOptions, { ...args, name })) so that createRecordsQueryOptions and any other references use providerOptions instead of _config.packages/ensnode-react/src/types.ts (1)
33-38:⚠️ Potential issue | 🟡 MinorUpdate stale doc wording from “config” to “options.”
The interface has been renamed to
WithEnsApiProviderOptions, but the header comment still referencesconfig.✏️ Suggested doc fix
- * Configuration parameter for hooks that need access to config + * Configuration parameter for hooks that need access to provider options🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ensnode-react/src/types.ts` around lines 33 - 38, The top-of-block doc comment above the WithEnsApiProviderOptions interface is stale (mentions "config"); update the comment to reference "options" instead so it matches the renamed interface and describes that it provides options for hooks needing access to provider options (i.e., change the wording in the comment above WithEnsApiProviderOptions to say "Configuration parameter for hooks that need access to options" or similar).packages/ensnode-react/src/hooks/useEnsApiProviderOptions.ts (1)
11-13:⚠️ Potential issue | 🟡 MinorUse “options” terminology consistently in JSDoc.
@throwsstill says “no config is available,” which is outdated for this hook.✏️ Suggested doc fix
- * `@throws` Error if no config is available in context or parameters + * `@throws` Error if no options are available in context or parameters🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ensnode-react/src/hooks/useEnsApiProviderOptions.ts` around lines 11 - 13, Update the JSDoc for the useEnsApiProviderOptions hook to use “options” terminology consistently: change any remaining references to “config” (e.g., in the `@throws` description) to mention “options” or “configuration” for this hook, and adjust the `@throws` text to something like “@throws Error if no options are available in context or parameters” so it accurately reflects the hook’s behavior; ensure the `@param` still documents the options parameter and remove any duplicate/outdated wording.apps/ensadmin/src/components/config/useEnsApiConfig.ts (1)
11-15:⚠️ Potential issue | 🟠 MajorDerived config query can go stale versus indexing-status source data.
This creates an independent cache entry from
indexingStatus.data?.configbut doesn’t reliably track source query updates for the same URL key. Prefer deriving directly fromuseIndexingStatusWithSwr()instead of nesting a second query.Suggested fix
-import { useQuery } from "@tanstack/react-query"; - -import { useEnsApiProviderOptions } from "@ensnode/ensnode-react"; - import { useIndexingStatusWithSwr } from "@/components/indexing-status"; export function useEnsApiConfig() { - const ensApiProviderOptions = useEnsApiProviderOptions(); const indexingStatus = useIndexingStatusWithSwr(); - return useQuery({ - enabled: indexingStatus.isSuccess, - queryKey: ["swr", ensApiProviderOptions.client.url.href, "config"], - queryFn: async () => indexingStatus.data?.config, // enabled flag ensures this is only called when indexingStatus.data is available - }); + return { + ...indexingStatus, + data: indexingStatus.data?.config, + }; }In TanStack Query v5, if a useQuery keeps the same queryKey but queryFn closes over changing external state, does the cached query automatically recompute/refetch, or can it remain stale until explicit invalidation/refetch?🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/ensadmin/src/components/config/useEnsApiConfig.ts` around lines 11 - 15, The current useQuery in useEnsApiConfig creates a separate cached entry (queryKey ["swr", ensApiProviderOptions.client.url.href, "config"]) that can become stale versus the source indexingStatus; instead, remove the secondary useQuery and return a value derived directly from useIndexingStatusWithSwr() (the indexingStatus object) — e.g., read indexingStatus.data?.config and indexingStatus.isSuccess and expose that directly from useEnsApiConfig so updates to useIndexingStatusWithSwr() immediately propagate; locate the useQuery call in useEnsApiConfig.ts (referenced symbols: useQuery, indexingStatus, ensApiProviderOptions.client.url.href) and replace it with a derived return (or a memoized computed value) based on indexingStatus rather than a new queryKey-based cache.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/ensadmin/src/components/connections/require-active-connection.tsx`:
- Line 13: RequireActiveConnection currently reads ensApiConfig.status from
useEnsApiConfig, but that hook is disabled when indexingStatus.isSuccess is
false so its status stays "pending" and the error UI is never shown; update
RequireActiveConnection to derive error/loading states from indexingStatus
directly (use indexingStatus.isError / indexingStatus.error to render the error
UI) or ensure useEnsApiConfig runs regardless of indexingStatus (remove the
query's enabled: false gating) so ensApiConfig.status can transition to "error";
locate the logic in RequireActiveConnection that uses ensApiConfig.status and
replace it with checks against indexingStatus (or re-enable the hook) and
propagate the indexing error into the same error rendering path.
In `@apps/ensadmin/src/components/providers/selected-ensnode-provider.tsx`:
- Around line 23-31: The hook useMemo is being called conditionally inside the
if that checks selectedConnection.validatedSelectedConnection.isValid; move the
useMemo call to the top-level of the component so hooks remain stable, e.g.
extract the validatedSelectedConnection and its url
(selectedConnection.validatedSelectedConnection.url) into a local variable, then
call useMemo once and inside its callback return createEnsApiOptions({ url })
when isValid is true or null/undefined when false; assign that result to options
and keep the conditional logic only inside the memo callback (referencing
selectedConnection, validatedSelectedConnection, isValid, url, useMemo,
createEnsApiOptions, and options).
In `@packages/ensnode-react/src/hooks/useNameTokens.ts`:
- Around line 17-20: The hook is passing the entire parameters object (which
includes hook-only fields like options and query) into
createNameTokensQueryOptions, causing unintended fields to flow into the
outgoing client.nameTokens call; update the call to pass only the
NameTokensRequest fields by creating a request object that omits options and
query (e.g., const request = { ...parameters } without options/query or
explicitly pick NameTokensRequest properties) and then call
createNameTokensQueryOptions(providerOptions, request) (ensure the request is
typed as NameTokensRequest) so only valid request fields reach
client.nameTokens.
In `@packages/ensnode-react/src/hooks/useRegistrarActions.ts`:
- Around line 21-24: The hook is passing the entire parameters object (which
contains hook-only fields options and query) into
createRegistrarActionsQueryOptions, risking sending internal fields as part of
RegistrarActionsRequest; update the call to build and pass only the request
payload (omit options and query) — e.g., destructure parameters to extract and
exclude options/query and pass the remaining request object into
createRegistrarActionsQueryOptions (so client.registrarActions receives only
valid RegistrarActionsRequest fields).
---
Outside diff comments:
In `@apps/ensadmin/src/app/mock/indexing-stats/page.tsx`:
- Around line 53-57: Remove the type assertion on the fixture and instead
explicitly type the variable so TypeScript enforces the full shape: replace the
usage of "as IndexingStatusResponseOk" when assigning to response from
indexingStatusResponseOkOmnichain[selectedVariant] with an explicit declaration
of response as EnsApiIndexingStatusResponseOk; this preserves compile-time
checks (so missing fields like config are caught) and keeps selectedVariant and
indexingStatusResponseOkOmnichain usage the same.
---
Duplicate comments:
In `@apps/ensadmin/src/components/config/useEnsApiConfig.ts`:
- Around line 11-15: The current useQuery in useEnsApiConfig creates a separate
cached entry (queryKey ["swr", ensApiProviderOptions.client.url.href, "config"])
that can become stale versus the source indexingStatus; instead, remove the
secondary useQuery and return a value derived directly from
useIndexingStatusWithSwr() (the indexingStatus object) — e.g., read
indexingStatus.data?.config and indexingStatus.isSuccess and expose that
directly from useEnsApiConfig so updates to useIndexingStatusWithSwr()
immediately propagate; locate the useQuery call in useEnsApiConfig.ts
(referenced symbols: useQuery, indexingStatus,
ensApiProviderOptions.client.url.href) and replace it with a derived return (or
a memoized computed value) based on indexingStatus rather than a new
queryKey-based cache.
In `@packages/ensnode-react/src/hooks/useEnsApiProviderOptions.ts`:
- Around line 11-13: Update the JSDoc for the useEnsApiProviderOptions hook to
use “options” terminology consistently: change any remaining references to
“config” (e.g., in the `@throws` description) to mention “options” or
“configuration” for this hook, and adjust the `@throws` text to something like
“@throws Error if no options are available in context or parameters” so it
accurately reflects the hook’s behavior; ensure the `@param` still documents the
options parameter and remove any duplicate/outdated wording.
In `@packages/ensnode-react/src/hooks/useRecords.ts`:
- Around line 57-63: Rename the local variable _config to providerOptions for
consistency with the options terminology: update the declaration that assigns
useEnsApiProviderOptions(options) from const _config =
useEnsApiProviderOptions(options); to const providerOptions =
useEnsApiProviderOptions(options); and then replace all uses of _config (e.g.,
in the call to createRecordsQueryOptions(providerOptions, { ...args, name })) so
that createRecordsQueryOptions and any other references use providerOptions
instead of _config.
In `@packages/ensnode-react/src/types.ts`:
- Around line 33-38: The top-of-block doc comment above the
WithEnsApiProviderOptions interface is stale (mentions "config"); update the
comment to reference "options" instead so it matches the renamed interface and
describes that it provides options for hooks needing access to provider options
(i.e., change the wording in the comment above WithEnsApiProviderOptions to say
"Configuration parameter for hooks that need access to options" or similar).
ℹ️ Review info
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (40)
apps/ensadmin/src/app/mock/config-api.mock.tsapps/ensadmin/src/app/mock/indexing-stats/page.tsxapps/ensadmin/src/app/mock/indexing-status-api.mock.tsapps/ensadmin/src/components/config/useEnsApiConfig.tsapps/ensadmin/src/components/connection/cards/ensnode-info.tsxapps/ensadmin/src/components/connections/require-active-connection.tsxapps/ensadmin/src/components/indexing-status/use-indexing-status-with-swr.tsapps/ensadmin/src/components/layout-wrapper.tsxapps/ensadmin/src/components/providers/selected-ensnode-provider.tsxapps/ensadmin/src/components/registrar-actions/use-stateful-fetch-registrar-actions.tsapps/ensadmin/src/hooks/active/use-active-connection.tsxapps/ensadmin/src/hooks/async/use-namespace.tsapps/ensapi/src/cache/indexing-status.cache.tsapps/ensapi/src/handlers/ensnode-api.routes.tsapps/ensapi/src/handlers/ensnode-api.tsapps/ensindexer/ponder/src/api/handlers/ensnode-api.tspackages/ensnode-react/README.mdpackages/ensnode-react/src/context.tspackages/ensnode-react/src/hooks/index.tspackages/ensnode-react/src/hooks/useENSNodeConfig.tspackages/ensnode-react/src/hooks/useENSNodeSDKConfig.tspackages/ensnode-react/src/hooks/useEnsApiProviderOptions.tspackages/ensnode-react/src/hooks/useIndexingStatus.tspackages/ensnode-react/src/hooks/useNameTokens.tspackages/ensnode-react/src/hooks/usePrimaryName.tspackages/ensnode-react/src/hooks/usePrimaryNames.tspackages/ensnode-react/src/hooks/useRecords.tspackages/ensnode-react/src/hooks/useRegistrarActions.tspackages/ensnode-react/src/hooks/useResolvedIdentity.tspackages/ensnode-react/src/provider.tsxpackages/ensnode-react/src/types.tspackages/ensnode-react/src/utils/query.tspackages/ensnode-sdk/src/ensapi/api/indexing-status/deserialize.tspackages/ensnode-sdk/src/ensapi/api/indexing-status/response.tspackages/ensnode-sdk/src/ensapi/api/indexing-status/serialize.tspackages/ensnode-sdk/src/ensapi/api/indexing-status/serialized-response.tspackages/ensnode-sdk/src/ensapi/api/indexing-status/zod-schemas.tspackages/ensnode-sdk/src/ensapi/client.test.tspackages/ensnode-sdk/src/ensapi/config/deserialize.tspackages/namehash-ui/src/components/identity/ResolveAndDisplayIdentity.tsx
💤 Files with no reviewable changes (2)
- packages/ensnode-react/src/hooks/useENSNodeConfig.ts
- packages/ensnode-react/src/hooks/useENSNodeSDKConfig.ts
| */ | ||
| export function RequireActiveConnection({ children }: PropsWithChildren) { | ||
| const { status, error } = useENSNodeConfig(); | ||
| const ensApiConfig = useEnsApiConfig(); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# First, let's check the useEnsApiConfig hook to see how it's gated
echo "=== Checking useEnsApiConfig implementation ==="
if [ -f "apps/ensadmin/src/components/config/useEnsApiConfig.ts" ]; then
cat -n "apps/ensadmin/src/components/config/useEnsApiConfig.ts"
else
echo "File not found, searching for it..."
find . -name "useEnsApiConfig.ts" -type f
fiRepository: namehash/ensnode
Length of output: 837
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Check RequireActiveConnection component
echo "=== Checking RequireActiveConnection implementation ==="
if [ -f "apps/ensadmin/src/components/connections/require-active-connection.tsx" ]; then
cat -n "apps/ensadmin/src/components/connections/require-active-connection.tsx"
else
echo "File not found, searching for it..."
find . -name "require-active-connection.tsx" -type f
fiRepository: namehash/ensnode
Length of output: 1284
Error UI is unreachable when indexing status fails during initial load.
RequireActiveConnection checks ensApiConfig.status to show error messages, but useEnsApiConfig has its query disabled when indexingStatus.isSuccess is false. When indexing fails before the first query execution, the status remains stuck at "pending" instead of transitioning to "error", leaving users with a permanent loading spinner. Either disable the component before calling the hook or derive error states directly from indexing status.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/ensadmin/src/components/connections/require-active-connection.tsx` at
line 13, RequireActiveConnection currently reads ensApiConfig.status from
useEnsApiConfig, but that hook is disabled when indexingStatus.isSuccess is
false so its status stays "pending" and the error UI is never shown; update
RequireActiveConnection to derive error/loading states from indexingStatus
directly (use indexingStatus.isError / indexingStatus.error to render the error
UI) or ensure useEnsApiConfig runs regardless of indexingStatus (remove the
query's enabled: false gating) so ensApiConfig.status can transition to "error";
locate the logic in RequireActiveConnection that uses ensApiConfig.status and
replace it with checks against indexingStatus (or re-enable the hook) and
propagate the indexing error into the same error rendering path.
| if (selectedConnection.validatedSelectedConnection.isValid) { | ||
| return ( | ||
| <ENSNodeProvider | ||
| config={{ client: { url: selectedConnection.validatedSelectedConnection.url } }} | ||
| > | ||
| {children} | ||
| </ENSNodeProvider> | ||
| const selectedConenctionUrl = selectedConnection.validatedSelectedConnection.url; | ||
| const options = useMemo( | ||
| () => | ||
| createEnsApiOptions({ | ||
| url: selectedConenctionUrl, | ||
| }), | ||
| [selectedConenctionUrl], | ||
| ); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# First, let's read the file to see the actual code structure
if [ -f "apps/ensadmin/src/components/providers/selected-ensnode-provider.tsx" ]; then
echo "=== Full file content ==="
cat -n "apps/ensadmin/src/components/providers/selected-ensnode-provider.tsx"
else
echo "File not found at expected location"
# Try to find the file
find . -name "selected-ensnode-provider.tsx" -type f 2>/dev/null || echo "Could not find file"
fiRepository: namehash/ensnode
Length of output: 2081
Move useMemo out of the conditional block.
useMemo is a hook and must not be called conditionally. The current code calls useMemo only when selectedConnection.validatedSelectedConnection.isValid is true, which violates React's Rules of Hooks. If this condition changes between renders, the hook call order will be inconsistent, breaking React's internal hook management and causing runtime errors.
Extract the URL at the top level and make the options creation conditional inside the useMemo callback instead:
Suggested fix
export function SelectedEnsApiProvider({ children }: PropsWithChildren) {
const selectedConnection = useSelectedConnection();
+ const selectedConnectionUrl = selectedConnection.validatedSelectedConnection.isValid
+ ? selectedConnection.validatedSelectedConnection.url
+ : undefined;
+ const options = useMemo(
+ () =>
+ selectedConnectionUrl
+ ? createEnsApiOptions({
+ url: selectedConnectionUrl,
+ })
+ : undefined,
+ [selectedConnectionUrl],
+ );
- if (selectedConnection.validatedSelectedConnection.isValid) {
- const selectedConenctionUrl = selectedConnection.validatedSelectedConnection.url;
- const options = useMemo(
- () =>
- createEnsApiOptions({
- url: selectedConenctionUrl,
- }),
- [selectedConenctionUrl],
- );
-
+ if (selectedConnection.validatedSelectedConnection.isValid && options) {
return <EnsApiProvider options={options}>{children}</EnsApiProvider>;
} else {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (selectedConnection.validatedSelectedConnection.isValid) { | |
| return ( | |
| <ENSNodeProvider | |
| config={{ client: { url: selectedConnection.validatedSelectedConnection.url } }} | |
| > | |
| {children} | |
| </ENSNodeProvider> | |
| const selectedConenctionUrl = selectedConnection.validatedSelectedConnection.url; | |
| const options = useMemo( | |
| () => | |
| createEnsApiOptions({ | |
| url: selectedConenctionUrl, | |
| }), | |
| [selectedConenctionUrl], | |
| ); | |
| export function SelectedEnsApiProvider({ children }: PropsWithChildren) { | |
| const selectedConnection = useSelectedConnection(); | |
| const selectedConnectionUrl = selectedConnection.validatedSelectedConnection.isValid | |
| ? selectedConnection.validatedSelectedConnection.url | |
| : undefined; | |
| const options = useMemo( | |
| () => | |
| selectedConnectionUrl | |
| ? createEnsApiOptions({ | |
| url: selectedConnectionUrl, | |
| }) | |
| : undefined, | |
| [selectedConnectionUrl], | |
| ); | |
| if (selectedConnection.validatedSelectedConnection.isValid && options) { | |
| return <EnsApiProvider options={options}>{children}</EnsApiProvider>; | |
| } else { | |
| return <>{children}</>; | |
| } | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/ensadmin/src/components/providers/selected-ensnode-provider.tsx` around
lines 23 - 31, The hook useMemo is being called conditionally inside the if that
checks selectedConnection.validatedSelectedConnection.isValid; move the useMemo
call to the top-level of the component so hooks remain stable, e.g. extract the
validatedSelectedConnection and its url
(selectedConnection.validatedSelectedConnection.url) into a local variable, then
call useMemo once and inside its callback return createEnsApiOptions({ url })
when isValid is true or null/undefined when false; assign that result to options
and keep the conditional logic only inside the memo callback (referencing
selectedConnection, validatedSelectedConnection, isValid, url, useMemo,
createEnsApiOptions, and options).
| const { options, query = {} } = parameters; | ||
| const providerOptions = useEnsApiProviderOptions(options); | ||
|
|
||
| const queryOptions = createNameTokensQueryOptions(_config, parameters); | ||
| const queryOptions = createNameTokensQueryOptions(providerOptions, parameters); |
There was a problem hiding this comment.
Only pass NameTokensRequest fields to the query builder.
At Line 20, passing full parameters includes hook-only fields (options, query) and can unintentionally alter the outgoing client.nameTokens(args) request payload.
💡 Proposed fix
export function useNameTokens(parameters: WithEnsApiProviderOptions & UseNameTokensParameters) {
- const { options, query = {} } = parameters;
+ const { options, query = {}, ...request } = parameters;
const providerOptions = useEnsApiProviderOptions(options);
- const queryOptions = createNameTokensQueryOptions(providerOptions, parameters);
+ const queryOptions = createNameTokensQueryOptions(providerOptions, request);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/ensnode-react/src/hooks/useNameTokens.ts` around lines 17 - 20, The
hook is passing the entire parameters object (which includes hook-only fields
like options and query) into createNameTokensQueryOptions, causing unintended
fields to flow into the outgoing client.nameTokens call; update the call to pass
only the NameTokensRequest fields by creating a request object that omits
options and query (e.g., const request = { ...parameters } without options/query
or explicitly pick NameTokensRequest properties) and then call
createNameTokensQueryOptions(providerOptions, request) (ensure the request is
typed as NameTokensRequest) so only valid request fields reach
client.nameTokens.
| const { options, query = {} } = parameters; | ||
| const providerOptions = useEnsApiProviderOptions(options); | ||
|
|
||
| const queryOptions = createRegistrarActionsQueryOptions(_config, parameters); | ||
| const queryOptions = createRegistrarActionsQueryOptions(providerOptions, parameters); |
There was a problem hiding this comment.
Pass only request fields into createRegistrarActionsQueryOptions.
At Line 24, parameters includes hook-only fields (options, query) and is passed as RegistrarActionsRequest. This can send unintended fields to client.registrarActions(args).
💡 Proposed fix
export function useRegistrarActions(
parameters: WithEnsApiProviderOptions & UseRegistrarActionsParameters = {},
) {
- const { options, query = {} } = parameters;
+ const { options, query = {}, ...request } = parameters;
const providerOptions = useEnsApiProviderOptions(options);
- const queryOptions = createRegistrarActionsQueryOptions(providerOptions, parameters);
+ const queryOptions = createRegistrarActionsQueryOptions(providerOptions, request);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/ensnode-react/src/hooks/useRegistrarActions.ts` around lines 21 -
24, The hook is passing the entire parameters object (which contains hook-only
fields options and query) into createRegistrarActionsQueryOptions, risking
sending internal fields as part of RegistrarActionsRequest; update the call to
build and pass only the request payload (omit options and query) — e.g.,
destructure parameters to extract and exclude options/query and pass the
remaining request object into createRegistrarActionsQueryOptions (so
client.registrarActions receives only valid RegistrarActionsRequest fields).
| const selectedConenctionUrl = selectedConnection.validatedSelectedConnection.url; | ||
| const options = useMemo( | ||
| () => | ||
| createEnsApiOptions({ | ||
| url: selectedConenctionUrl, | ||
| }), | ||
| [selectedConenctionUrl], |
There was a problem hiding this comment.
Typo: selectedConenctionUrl should be selectedConnectionUrl
| const selectedConenctionUrl = selectedConnection.validatedSelectedConnection.url; | |
| const options = useMemo( | |
| () => | |
| createEnsApiOptions({ | |
| url: selectedConenctionUrl, | |
| }), | |
| [selectedConenctionUrl], | |
| const selectedConnectionUrl = selectedConnection.validatedSelectedConnection.url; | |
| const options = useMemo( | |
| () => | |
| createEnsApiOptions({ | |
| url: selectedConnectionUrl, | |
| }), | |
| [selectedConnectionUrl], |
Additional Comments (1)
Options:
|
Lite PR
Tip: Review docs on the ENSNode PR process
Summary
/api/configendpoint into/api/indexing-statusendpointWhy
Testing
Notes for Reviewer (Optional)
/api/configinto/api/indexing-status#1405Pre-Review Checklist (Blocking)