[GH-ISSUE #871] usePathname temporarily resolves to "/" on the client before navigating to the correct pathname #191

Closed
opened 2026-05-06 12:38:00 +02:00 by BreizhHardware · 0 comments

Originally created by @Bananamilk452 on GitHub (Apr 22, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/871

Description

When using usePathname, the server correctly logs the expected pathname (e.g. "/home"), but on the client side it briefly resolves to "/" before moving to the correct path. This mismatch causes a hydration error.


Steps to Reproduce

  1. Use usePathname in a component
  2. Add a console.log
  3. Navigate to a route such as /home
  4. Observe the server logs /home correctly, but the client initially logs / before correcting to /home

Expected Behavior

usePathname should return the correct pathname on both server and client without any intermediate "/" state.


Actual Behavior

  • Server: usePathname"/home"
  • Client (initial): usePathname"/"
  • Client (after correction): usePathname"/home"
  • Results in a hydration mismatch error

Additional Context

This may be a regression of #688 — needs verification.


Originally created by @Bananamilk452 on GitHub (Apr 22, 2026). Original GitHub issue: https://github.com/cloudflare/vinext/issues/871 ### Description When using `usePathname`, the server correctly logs the expected pathname (e.g. `"/home"`), but on the client side it briefly resolves to `"/"` before moving to the correct path. This mismatch causes a **hydration error**. --- ### Steps to Reproduce 1. Use `usePathname` in a component 2. Add a `console.log` 3. Navigate to a route such as `/home` 4. Observe the server logs `/home` correctly, but the client initially logs `/` before correcting to `/home` --- ### Expected Behavior `usePathname` should return the correct pathname on both server and client without any intermediate `"/"` state. --- ### Actual Behavior - **Server:** `usePathname` → `"/home"` ✅ - **Client (initial):** `usePathname` → `"/"` ❌ - **Client (after correction):** `usePathname` → `"/home"` ✅ - Results in a hydration mismatch error --- ### Additional Context This may be a regression of #688 — needs verification. ---
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#191
No description provided.