Skip to content

Conversation

@Y3drk
Copy link
Contributor

@Y3drk Y3drk commented Jan 2, 2026

fix(ensadmin): remove name param when not on /name route

Reviewer Focus (Read This First)

What reviewers should focus on
  • I don't feel super comfortable tinkering with the next/router elements and global hooks, my confidence being even worse when they're combined. Even though I read up on Next.js's docs and studied our other hooks, I fear that this fix might not be performance-efficient.
    The way I understand it, the proposed implementation should be called only when the URL changes and not affect the loading of the content, but I'd really value a verification on that part.
  • As always, appreciate advice on naming
  • Recommend double-checking the UI behavior when browsing the page (another set of eyes for manual testing).

Problem & Motivation

Why this exists

What Changed (Concrete)

What actually changed

Changes are limited to apps/ensadmin.

  1. Added new generic hook: UseClearUrlParams (@ apps/ensadmin/src/hooks/use-clear-url-params.tsx)
  2. Placed it in the main layout, wrapped with general <Suspense> (@ apps/ensadmin/src/app/layout.tsx:66) and spec'ed it to only remove name param when not on /name

Due to that, on every route change (either by UI or manually editing the URL), the page's URL will be checked for redundant parameters, and any unwanted ones will be cleared.


Design & Planning

How this approach was chosen

Path to current solution:

  • Initially used Google to read up on the problem. Searched third-party sites like StackOverflow or Reddit for a community solution, but found that lacking
  • Later, combined the official docs of Next.js naviagtion (namely useRouter#router-events example) and LLM (as a brainstorming tool) to come up with the current solution
  • Briefly considered creating a hook specifically for the name parameter, but classified it as a bad idea due to the possible need to handle other parameters in the future and the intuition that such solutions are against every reusability-related good practice possible.

Considered alternatives:

  • I entertained the idea of performing the clean-up similarly to how useRawConnectionUrlParam is currently used → calling it separately on all of our pages inside ensadmin/src/app
    • Deemed it workable but inefficient, as it would reduce code quality (boilerplate) due to essentially copy-pasting the same hook call everywhere, thus every change to the clean-up policy in the future would force the developer to check and possibly change all the places where this hook would be called.

Self-Review

What you caught yourself
  • Bugs caught: None
  • Logic simplified: -
  • Naming / terminology improved: Feeling unsure about the hook name (UseClearUrlParams) but cannot think of anything better
  • Dead or unnecessary code removed (or why none was): This PR introduces new logic and is not replacing any previous functionality.

Cross-Codebase Alignment

Related code you checked
  • Looked for inspiration in useRawConnectionUrlParam & useConnectionsLibrary
  • Decided to take a different path, left these ones alone
  • Googled quite a lot (see more in Design&Planning)

NOTE: not sure if the last point is a good application of the template instruction, let me know if it's redundant

  • Search terms used: queryParams, pathParams, next/navigation
  • Reviewed but unchanged: apps/ensadmin/src/hooks/use-connection-url-param.tsx, apps/ensadmin/src/hooks/use-connections-library.tsx, apps/ensadmin/src/app/name/page.tsx

Downstream & Consumer Impact

Who this affects and how
  • This PR should generally allow us to remove any redundant URL parameters from ENSAdmin's routes, making the page's structure clearer to users and helping to avoid overall confusion (questions like "why is the name parameter provided for the /connection route?" should not be popping up anymore).
  • That should grant:
    • Better UX for the users
    • Easier debugging and coding for our devs
  • Public APIs affected: None
  • Docs updated: None
  • Naming decisions worth calling out: general naming of the hook defined @ apps/ensadmin/src/hooks/use-clear-url-params.tsx

Testing Evidence

How this was validated
  • Tested manually in local env and the Vercel preview → had a look at the overall feel (also in comparison to the current prod version), and network tab in dev tools. Everything seems fine.
  • Confirmed general logic to be correct, cannot be 100% sure about overall performance efficiency

If this is wrong, what breaks first:

  • Routing in ENSAdmin (99.99% sure it would only affect query parameters, but flagging this to stay cautious about this PR)
  • ENSAdmin response/loading times (if the hook is called too often might degrade performance)
  • Testing performed: Manual testing performed locally and in the Vercel preview
  • Known gaps: Lack of E2E testing within the CI with tools like Cypress or Playwright (a meaningful overhead to introduce, well-known issue for the entire ENSAdmin) → essentially we're limited to manual testing for the UI
  • What reviewers have to reason about manually (and why): testing the changing of the routes via the UI or direct URL edition (due to the reason described in know gaps)

Scope Reductions

What you intentionally didn't do
  • No follow-ups you identified so far.
  • Follow-ups: None
  • Why they were deferred: -

Risk Analysis

How this could go wrong
  • Assumption: PR relies on the assumption that no matter how (UI vs manual URL editing), the URL changes the useClearUrlParams hook will be called exactly once per route change. This affects both the logic (clearing up redundant params) and efficiency of the App.
  • Likely failure modes:
    • name param not being deleted
    • connection param being deleted
    • General lagging of the app
  • Blast radius → the ENSAdmin app
  • Risk areas: ENSAdmin app
  • Mitigations or rollback options: Remove the UseClearUrlParams hook from apps/ensadmin/src/app/layout.tsx (will simply rollback to the state before this PR)
  • Named owner if this causes problems: @Y3drk

Pre-Review Checklist (Blocking)

  • I reviewed every line of this diff and understand it end-to-end
  • I'm prepared to defend this PR line-by-line in review
  • I'm comfortable being the on-call owner for this change
  • Relevant changesets are included (or explicitly not required)

@changeset-bot
Copy link

changeset-bot bot commented Jan 2, 2026

🦋 Changeset detected

Latest commit: 9581785

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
ensadmin Patch
ensindexer Patch
ensrainbow Patch
ensapi Patch
fallback-ensapi Patch
@ensnode/datasources Patch
@ensnode/ensrainbow-sdk Patch
@ensnode/ponder-metadata Patch
@ensnode/ensnode-schema Patch
@ensnode/ensnode-react Patch
@ensnode/ponder-subgraph Patch
@ensnode/ensnode-sdk Patch
@ensnode/shared-configs Patch
@docs/ensnode Patch
@docs/ensrainbow Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jan 2, 2026

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

Project Deployment Review Updated (UTC)
admin.ensnode.io Ready Ready Preview, Comment Jan 2, 2026 2:27pm
ensnode.io Ready Ready Preview, Comment Jan 2, 2026 2:27pm
ensrainbow.io Ready Ready Preview, Comment Jan 2, 2026 2:27pm

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.

ENSAdmin ?name= param stays on page regardless of route, need to just affect the profile pages

2 participants