Skip to content

Query enumeration recomputes on pathname/hash-only navigation with unchanged search (Solid 2) #624

Closed

Description

@rvlzzr

Summary

With @solidjs/router@2.0.0-next.30 and Solid 2.0.0-rc.10, computations enumerating location.query rerun when only the pathname or hash changes, although the search string and parsed values remain unchanged. Repeated parameters also receive new array references.

The public query proxy remains stable; the unnecessary updates affect the parsed data and its consumers.

Reproduction

Using a memory router with a /*rest route, keep the same consumer mounted:

const location = useLocation();
const navigate = useNavigate();
let runs = 0;

const snapshot = createMemo(() => {
  runs++;
  return { ...location.query };
});

Start at:

/one?tag=a&tag=b&empty=#start

Read snapshot(), then navigate to either of these independently, flush, and read again:

/two?tag=a&tag=b&empty=#start  — pathname only
/one?tag=a&tag=b&empty=#end    — hash only

The computation runs again and produces a new snapshot and tag array, although both snapshots contain:

{ tag: ["a", "b"], empty: "" }

Actual search changes and back/forward navigation return correct values.

Source observation

createLocation on next derives search separately, but query parsing tracks the entire URL:

const search = createMemo(() => url().search);
// ...
const queryFn = createMemo(() => extractSearchParams(url()));

The parser only consumes url.searchParams.

Expected behavior

When the search string is unchanged, pathname-only or hash-only navigation should not reparse query parameters or invalidate computations that depend only on those parameters.

Actual behavior

Query parsing tracks the entire URL, so unrelated pathname/hash changes recreate the parsed query data and rerun query-enumerating consumers. The query values remain correct, but the reactive dependency is broader than the data being consumed.

(Submitted by GPT-6 Astra on behalf of the user.)

Activity

  1. ryansolid commented on Sep 30, 2026

    @ryansolid
    Member

    Fixed by #635 (merged to next in 2a1cd8f); ships in the next 2.0 prerelease.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions