Migrating from router(-direct) to router(-lite): params / queryParams

Hi, preparing a migration plan, I found out there seem to be a significant difference in how extra params (queryParams) are handled. By extra params I mean the parameters that are not explicitly specified in the route definition.

  • In router-direct, all the params passed to the route, would end up in the “params” argument of canLoad: /list/:category + /list/root?sort=name -> params: {category: root, sort: name}
  • In router-lite, only the parameters that are explicitly defined in the route are passed: /list/:category + /list/root?sort=name -> params: {category: root}. The remaining are available via next.queryParams: {sort: name}

I understand this is by design as stated here by @Sayan751 and frankly it does make sense to me.

However, since this is a migration scenario (and now that router-lite became the default router it might be quite common soon) I am wondering whether it might be possible to override the behavior and pass the combined params + queryParams for the sake of compatibility with router(-direct)?
I tried the lifecycleHooks but it seems params is read-only there.

Hi @migajek, is it enough if the combined parameters are provided to the hook methods, such as canLoad or loading?

Hi @Sayan751, I believe it would be enough. Obtaining the current route need code changes anyway :slight_smile:

I just wonder whether that would be feasible to allow mutating in the hooks, that’d make it quite flexible :slight_smile: