emberjs / emberjs/ember.js

Query params from link-to destination wiped out if the current URL has a different query param

Open
#16,867 2 comments 0 reactions 0 assignees View on GitHub
documentation Query Params Routing
Dominant language
TypeScript
Stars
22.6k
Forks
4.2k
Avg merge
3d 12h
Merged PRs (30d)
15

Description

Hi all,

I'm experiencing an issue where I have a link-to specifying a particular query param with its destination, like so: `{{#link-to "foo.bar" (query-params baz=true)}}`. This link-to is on route `my-route` with a _different_ query param (URL has "my-route?creating=true"). When I click that link-to, I am successfully taken to `foo.bar`, but my query param of `baz=true` seems to be wiped out.

I can get around this by adding "baz" to the query params on the controller for "my-route" like so: `queryParams: ['creating', 'baz']`, but this seems like a band-aid fix to a larger problem. And it doesn't entirely make sense because `baz` is not relevant to "my-route".

My team's project is currently on version 2.18 of Ember. I've looked around for other similar issues posted here but could not find anything. Apologies if there is one that I missed somewhere.

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.