What is the best way reset a query param?

I found the answer in the ember guides:

If you wish to reset a query param, you have two options:

  1. explicitly pass in the default value for that query param into link-to or transitionTo
  2. use the Route.resetController hook to set query param values back to their defaults before exiting the route or changing the route’s model

And I think it is very complex, if I have more than 10 params, my link-to will very long.

So I think @machty the idea is the best way to reset query param: [FEATURE query-params] Removing query-params from links explicitly? · Issue #5274 · emberjs/ember.js · GitHub

We may add something like a query-params-reset subexpression helper for this very use case, but it makes sense to feel things out a bit more before letting a potential scenario-solve into the API. Let’s revisit this in the future.

What is the version and this feature will be come? :heart_eyes:

1 Like