LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-ada
createdAtNov 6, 2026, 10:38 PM
updatedAtNov 6, 2026, 11:22 PM
githubUrlhttps://github.com/neomjs/neo/issues/20489
authorneo-opus-ada
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[x] 6611 Earthquakes Tutorial: Add a new maps provider
closedAtNov 6, 2026, 11:22 PM

Xhr appends a second ? to a URL that already has a query

neo-opus-ada
neo-opus-ada commented on Nov 6, 2026, 10:38 PM

Context

The keyless Earthquakes tutorial (#6611) loads a Store from a URL that carries its own query: https://nameless-tundra-27404.herokuapp.com/go/?fn=earthquakes. Sophie ran it against a packed consumer at dev d7e91ec544. The Store's default Xhr pipeline adds page and pageSize, and the request goes out as:

https://nameless-tundra-27404.herokuapp.com/go/?fn=earthquakes?page=1&pageSize=0

The service answers HTTP 200 with the body earthquakes?page=1 is not a function., which is not JSON. The bare URL works and returns 76 rows. This blocks #6611's keyless outcome.

The Problem

Neo.data.connection.Xhr#request adds params with opts.url += ('?' + new URLSearchParams(opts.params).toString()) (src/data/connection/Xhr.mjs:190 at dev 5f57baeadf). The ? is unconditional, so:

  • a URL that already has a query gets a second ?, and the server reads the params as part of the existing value;
  • a URL with a #fragment gets the params after the #, where they never reach the server;
  • an empty params object leaves a trailing ?.

The Architectural Reality

  • Xhr#request resolves the URL (resolveUrl) and then appends the params. That append is the only '?' + URLSearchParams composition in src/; Fetch never puts params into its URL.
  • Store loads reach it through Xhr#read(params) → request({…, params}).
  • test/playwright/unit/data/connection/UrlResolution.spec.mjs already stubs XMLHttpRequest to capture the URL passed to open(). That is the right place to observe the composed request.
  • Design authority: n/a. The defect is an observed failure (the error body above), not a contested behavior.

The Fix

In src/data/connection/Xhr.mjs, compose the params into the resolved URL:

  • params go before a #fragment;
  • they join an existing query with &, and add no extra separator when the query is empty (/data?) or ends in &; a ? inside a query value (/data?q=why?) stays part of that value (narrowed 2026-11-06 from "ends in ? or &", per Emmy's review on #20490);
  • an empty params object leaves the URL unchanged;
  • relative URLs stay relative. Use string composition, not new URL(), which needs a base.

Acceptance Criteria

  • A URL with a query gets its params after &: …/go/?fn=earthquakes + {page: 1, pageSize: 0} → …/go/?fn=earthquakes&page=1&pageSize=0.
  • A URL with a fragment gets its params before the #, with and without an existing query.
  • A URL with no query still gets ? + params; an empty params object leaves the URL as it is; a relative URL stays relative.
  • Each case is pinned through Xhr#request with a recording XMLHttpRequest stub, and fails on dev.

Out of Scope

  • #6611's tutorial work and its native acceptance (Sophie keeps both).
  • Fetch and Stream, which do not compose params into the URL.

Related

Blocks #6611. Found during #6611's packed-consumer run (Sophie).

Live latest-open + closed sweep: checked the latest 20 open issues, plus closed searches for Xhr query and Xhr params url, and ask_knowledge_base (ticket); no equivalent found, at 2026-11-06T21:37Z. A2A in-flight sweep: the latest 30 messages, no Xhr claim. MC sweep: no prior decision. Own-assignment sweep: #5218 only, unrelated.

Origin Session ID: ea25dda9-c67e-40bb-bd4f-9c4b99dc30fd

⚖️ Ada · @neo-opus-ada · Claude Opus 5.5 · Claude Code

tobiu referenced in commit 2f6e04b - "fix(data): Xhr composes params into a URL that has a query or fragment (#20489) (#20490) on Nov 6, 2026, 11:22 PM
tobiu closed this issue on Nov 6, 2026, 11:22 PM