Bizarre query param error in fastboot only


#1

I’m developing an app locally using ember serve and have occasionally run it with fastboot to make sure everything is compatible.

Unfortunately, it’s been a while since I’ve done that and alot of code’s been added. When I tried fastboot just now I am getting bizarre errors regarding my query params:

Error while processing route: category Assertion Failed: You're not allowed to have more than one controller property map to the same query param key, but bothapplication:pagingandcategory:pagingmap topaging. You can fix this by mapping one of the controller properties to a different query param key via theasconfig option, e.g.paging: { as: ‘other-paging’ }`

The reason it’s bizarre is three-fold.

  1. There is no such error in ‘normal’ ember (:4200).
  2. The params it’s complaining about are not in application: They are all set in the controllers.
  3. When I first start fastboot and access the app it works just fine. The error only presents itself when I do a hard refresh.

I’ve been perusing all my new code and I am drawing a blank as to how these assignments are making it up to the application level! Anyone have any ideas?


#2

Little more info. I switched on all the logging and it looks like the error is happening in the application deserialize hook. After starting fastboot and loading a url (with query params), this going just fine…

Attempting URL transition to /category/jewelry?page=2&paging=48&sort=new
...
Preparing to transition from '' to 'category'
Transition #0: application: calling beforeModel hook
Transition #0: application: calling deserialize hook
Transition #0: application: calling afterModel hook
Transition #0: category: calling beforeModel hook
Transition #0: category: calling deserialize hook
[ ] model:category ............................................. searchapp/models/category
...

And I can use the app normally. But if I try to hard-refresh a page with query params…

Attempting URL transition to /category/jewelry?page=2&paging=48&sort=new
Preparing to transition from '' to 'category'
Transition #0: application: calling beforeModel hook
Transition #0: application: calling deserialize hook
[ ] template:application-error ................................. undefined
...
Error while processing route: category Assertion Failed: You're not allowed to have more than one controller property map to the same query param key, but both `application:paging` and `category:paging` map to `paging`. You can fix this by mapping one of the controller properties to a different query param key via the `as` config option, e.g. `paging: { as: 'other-paging' }` Error

Totally perplexing


#3

Alright, figured this out. In my category.js controller file I am setting refreshModel: true for my query params like this:

init() {
	this._super(...arguments);
	Object.keys(cfg.defaultCategoryParams).forEach((qp) => {
		this.queryParams[qp] = { refreshModel: true };
	});
},

What was missing was the property itself:

queryParams: {},
init() {
	this._super(...arguments);
	Object.keys(cfg.defaultCategoryParams).forEach((qp) => {
		this.queryParams[qp] = { refreshModel: true };
	});
},