Uh oh!
There was an error while loading. Please reload this page.
fix: preserve queryParams in memory/static/abstract Router mode - #22
Merged
joaodibba merged 1 commit intoJun 15, 2026
Merged
Conversation
In Router.go(), the memory/static/abstract branch was storing only the
bare pathname (without query string) in this.url before calling
handleRoute(). This meant that even though queryParams were saved to
#props directly, matchRoute() / getRouterParams() received a URL with
no searchParams, so Router.props was always {} after the route settled.
Fix: pass newUrl (built by buildURL, which already appends the query
string) to this.url instead of the bare path. handleRoute() then
constructs a URL object from it, preserving the search params that
getRouterParams() iterates over. buildRoutePage() sets #props from
match.params, which now correctly includes the query parameters.
Adds five regression tests covering: single param, multiple params,
no params, empty params object, and params-not-bleeding-across-navigations.
Closes audit item 3.Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In
Router.go(), thememory/static/abstractbranch stored only the bare pathname inthis.urlbefore callinghandleRoute().Because
handleRoute()constructs aURLobject fromthis.url, it received no query string — sogetRouterParams()found nothing inurl.searchParams, andRouter.propswas always{}even whenqueryParamswere passed.The fix is one line: pass
newUrl(whichbuildURLalready appends?key=valueto) instead of the rawurl.File changed:
src/core/router/Router.ts} else { // For memory, static, and abstract modes, update internal state and trigger route handling - Router.#router.url = url;+ // Include query params in the internal URL so handleRoute() / getRouterParams() can parse them.+ Router.#router.url = newUrl; Router.#router.#props = extras?.queryParams || {}; Router.#router.handleRoute(); }handleRoute()already callsnew URL("http://localhost" + urlPath)and stores onlyurl.pathnameback intothis.url, soRouter.pathnameis unaffected.getRouterParams()already iteratesurl.searchParams, so no further changes are needed there.Regression tests added
Five new tests in
tests/router.test.ts(describe: Router – queryParams in memory mode):Router.propscontains{ q: 'hello' }Router.propsRouter.props === {}Router.props === {}Router.props === {}Validation
Roadmap alignment
Addresses audit item 3. Minimal one-line source fix with full query-param regression suite.
Reviewer: @zico15