Typescript error when resolve has a query string parameter
#14103
resolve has a query string parameterDevelopment PRs
Summary
Adds a ResolvablePath type that extends Pathname with optional ?${string} and #${string} suffixes, allowing resolve() to accept pathnames with query strings and hash fragments.
- No runtime changes —
resolve_route()already passes through?and#correctly Pathnametype is unchanged (still used forpage.url.pathname)- Existing
resolve()behavior with route IDs and params is unaffected
Motivation
Currently there is no way to use goto() with query strings or hash fragments without either disabling the lint rule or bypassing resolve():
resolve('/products?page=2')fails type-checking (Pathnamedoesn't include?)goto(resolve('/products') + '?page=2')fails thesvelte/no-navigation-without-resolvelint rule (argument isn't aresolve()call)
Per @teemingc's suggestion in #14750:
"It should be possible to add a union type with a template string such as
/my-route#${string}and/my-route?${string}. This would continue to keep the function type-safe."
This is a minimal type-only fix that doesn't conflict with #14756 (which adds richer { hash, searchParams } options).
What this enables
// All of these now type-check AND satisfy the lint rule:
goto(resolve('/products?page=2'));
goto(resolve(`/search?${params}`));
goto(resolve('/docs/intro#getting-started'));
Test plan
-
pnpm checkpasses -
pnpm lintpasses - Existing tests pass (no runtime changes, only type widening)
Closes #14750
fixes:- #554 depends:- sashakt-platform/sashakt-core#550
Summary by CodeRabbit
Summary by CodeRabbit
-
New Features
- Added an organization filter to the users admin page (super admins only).
- Introduced organization search and selection with dropdown behavior.
- Added a dedicated organization lookup API with optional search.
-
Bug Fixes
- Improved filter URL synchronization for better reliability.
- Ensured single-selection updates the URL immediately after choosing an organization.
-
Tests
- Updated users page tests to cover organization filtering behavior.
- Added component tests for organization selection, error handling, and navigation.
Closes reviewer items 8 and 10 in docs/Portal_to_do_list.md: link each taxon to its taxonomic source, and reach a per-species distribution map from the map view.
Both turned out to be unreachable rather than unbuilt, so this fixes the structure instead of adding a third path through it.
The correctness bug this surfaced
getDistributionForRank grouped occurrence_status away, so a species' native and introduced ranges rendered identically. Psidium guajava is native to 12 areas and introduced in 103 — all 115 were drawn in one colour. That is close to reviewer item 9, where a reader cannot tell whether a country means native, naturalised or merely cultivated.
Species maps are now categorical (ColorBrewer Set2) with a status legend; higher taxa keep the graduated count ramp.
One presentation of a taxon
A species was rendered by two modal overlays that did not know about each other, neither with a URL. TaxonScheda replaces both and is hosted twice — as a Skeleton dialog opened in place, and at /species/[wcfpId] for a link that can be shared or reloaded. Shallow routing gives the dialog a real URL, so Back closes it rather than leaving the page.
Deleted: SpeciesDetailPanel, SpeciesDetailHost, OverlayPanel, species-detail-state. Skeleton's Dialog already does the focus trap the portal was hand-rolling, and does it correctly — the old distribution overlay never restored focus at all.
The region panel's dead action
The "N areas" action was inert on /map/[region] for three independent reasons: region nodes carried no distributionAreaCount, SpeciesPanelView passed no isNodeClickable (which defaults to false), and the overlay lived in a component only /taxonomy mounted. All three are fixed, so the same row behaves the same way on both surfaces.
Also
- Winkel Tripel on both maps from one shared projection; the distribution map had been hand-rolling a linear projector. Zoom is capped at 2.5× a world view so a single-region taxon keeps its geographic context.
ReferenceListis shared by the scheda and the About page, which had drifted apart on heading, list style, link colour andrel. DOIs and URLs inside free-text citations are linked only when they parse and are unambiguous — the checklist contains URLs cut mid-phrase, and a wrong link is worse than none.- The choropleth re-projects once a resize settles rather than every frame of the panel transition; 368 features is roughly 2 MB of path data.
- Light mode is now a stated decision rather than a TODO. The palette, the map's red ramp and the partner logos are all built for a light ground.
Verification
pnpm checkclean, 66/66 tests pass (21 files)- Data checked against
wcfp.duckdb: every one of 26,622 records carries a source link, all four registries resolve, and14370returns 12 native / 103 introduced - Driven in the browser at 1280×1000 and 375×812: dialog open/close/Back, both hosts, the region chip, mobile bottom sheet
- Four specs that were already failing at
HEADon a stale placeholder are fixed
Deploy workflow — read before merging
deploy.yml was disarmed in 4b3c54d because running it would have taken the site down. It is rewritten here for adapter-node with versioned releases, an atomic current symlink, rollback on a failed health check, and pnpm check / pnpm test gates. Release logic was verified in a Debian container.
It remains workflow_dispatch only and disabled_manually at the GitHub API layer. Arming it needs new secrets (SSH_APP_PATH, HEALTHCHECK_URL, optionally SERVICE_NAME) and a systemd unit whose WorkingDirectory is $SSH_APP_PATH/current. That is a separate decision, deliberately not taken here.
Worth a close look
queries.ts— dropping theGROUP BYis safe because(wcfp_id, code)is unique indistribution(verified: 376,373 rows, 0 duplicate pairs)linkify.ts— the heuristic that refuses ambiguous URLs- The deletion of
OverlayPanelin favour of Skeleton'sDialog
Summary by CodeRabbit
-
New Features
- Added dedicated species pages with shareable links, overview and geographical distribution tabs, source details, references, uses, and permalink copying.
- Added richer taxon detail dialogs with loading, retry, and no-data states.
- Maps now show occurrence categories—native, introduced, extinct, and doubtful—with matching legends and area summaries.
- Added reusable, automatically linkified reference lists and clearer source citations.
-
Improvements
- Improved map projection, resizing, accessibility labels, and geographic filter wording.
- Standardized light-mode presentation across the portal.
Issue
Describe the bug
This is fine:
This should be fine, but is not:
Reproduction
Use the new resolve function with a query string parameter in the first parameter's string.
Logs
System Info
npx envinfo --system --npmPackages svelte,rollup,webpack --binaries --browsers
System:
OS: macOS 15.5
CPU: (8) arm64 Apple M2
Memory: 227.25 MB / 16.00 GB
Shell: 3.7.1 - /Users/m/.local/share/devbox/global/default/.devbox/nix/profile/default/bin/fish
Binaries:
Node: 22.14.0 - ~/projects/github/pipestack/webapp/main/.devbox/nix/profile/default/bin/node
npm: 10.9.2 - ~/projects/github/pipestack/webapp/main/.devbox/nix/profile/default/bin/npm
Browsers:
Brave Browser: 137.1.79.118
Chrome: 138.0.7204.184
Safari: 18.5
npmPackages:
svelte: ^5.37.3 => 5.37.3
Severity
blocking an upgrade of svelte
I think this is intentional... or at least I'm not sure there's any way around it. I would do this: ${resolve('/[workspaceSlug]/pipeline', { workspaceSlug: 'demo' })}?{queryParams}
Maybe @Rich-Harris has a more-clever idea for something we could do with types to make this work? But in my mental model resolve operates on pathnames, not full-blown URLs.
See also #14062 for another thing we need to decide whether it's intentional - It was my impression that this should be passed actual route identifiers, which would mean including named groups where they exist, and not including query parameters.
Ah fair enough, operating on route identifiers is fine. The now deprecated resolveRoute function accepted query parameters and my global find & replace migration to resolve was a bit too basic 😊.
there is also a 2nd problem here, underlined on the screenshot: expected one argument but got 2. Is this being also addressed somewhere?
@mispp this is expected -- you can only provide the second parameter if the first is a valid path in your app. See my comment above for the workaround.
Ah fair enough, operating on route identifiers is fine. The now deprecated
resolveRoutefunction accepted query parameters and my global find & replace migration toresolvewas a bit too basic 😊.
The thing is, if there's no way to add query params inside a resolve call, that means there's also no way (afaik) to satisfy the linter that a relative URL has been resolved if it includes params. We're stuck between a rock and a hard place.
Is there any planned work to add support for query params? I'm stuck in so many cases where eslint complains with:
Unexpected goto() call without resolve()
But there's no way to make it happy with tricks like:
goto(`${resolve('/[slug]/path', { slug: 'demo' })}?key=val`)Fwiw, I set "svelte/no-navigation-without-resolve": "warn" in ESLint config in all my Svelte projects and am just dealing with the warnings on a best-effort basis.
I still find it confusing that the lint rule landed, defaulting to "error", when the feature that it depends on seems not to be 100% finished.
Someone has a PR for this in sveltejs/eslint-plugin-svelte#1381