Skip to content

@void/solid: useParams() keeps the first page's params after client-side navigation #708

Closed

Description

@yujiym

Problem

In a Solid pages app, useParams() keeps returning the params of the first page rendered, for the rest of the session. useRouter().params on the same page returns the correct values.

Reproduction

https://github.com/yujiym/void-solid-useparams-repro

pnpm install
pnpm dev
  1. Open /cards/xyz directly.
  2. Click Home, then /cards/abc.
  3. Click /cards/def.
  4. Press the browser's back button.
Step useParams().slug useRouter().params.slug
Load /cards/xyz directly xyz xyz
Home, then /cards/abc xyz (stale) abc
/cards/def from the card page xyz (stale) def
Browser back to /cards/abc xyz (stale) abc

The browser console shows no errors.

Expected behavior

useParams() returns the params of the current page, matching useRouter().params.

Cause

The generated Solid client provides the params like this (packages/solid/src/plugin-pages.ts):

createComponent(ParamsContext.Provider, {
  get value() { return routeParams(); },

Solid's context provider reads props.value inside untrack when it is created, so the getter doesn't subscribe to routeParams. The context keeps the first params object, even for pages created after a navigation.

useRouter().params reads the routeParams signal directly, which is why it stays correct.

Possible fix

Provide a stable createMutable object and update it in place in applyUpdate, as this file already does for shared. #610 fixed the same symptom in @void/svelte by updating its params object in place.

I'm happy to open a PR. Opened in #709.

Environment

  • void and @void/solid 1.6.1; the same provider code is on main at 5d2a2ff
  • Also reproduced on 1.4.0 and 1.5.0
  • solid-js 1.9.18, Node 24, pnpm 11.20.0
  • vite dev, headless Chromium

Activity

  1. added a commit that references this issue on Nov 5, 2026
    e3c8a15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions