Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion Failed: You're not allowed to have more than one controller property map to the same query param key #13258

Closed
Arkham opened this issue Apr 5, 2016 · 12 comments

Comments

@Arkham
Copy link

Arkham commented Apr 5, 2016

Hi there,

I just updated one of my apps to v2.4.4 and I saw this error popping up:

Error while processing route: other Assertion Failed: You're not allowed to have more
than one controller property map to the same query param key, but both
`application:perPage` and `application:perPage` map to `per_page`. You can fix this
by mapping one of the controller properties to a different query param key via the `as`
config option, e.g. `perPage: { as: 'other-perPage' }`

The weird thing is that it appears that the error is referring to the same queryParam. If I revert this commit (#13202) the code works as intended.

Here is an ember twiddle reproducing the error: https://ember-twiddle.com/23c9bc41197b73fc8874a35b04c1a635

The setup I've been running is:

Ember      : 2.4.4
Ember Data : 2.4.3
jQuery     : 1.11.3
@rwjblue
Copy link
Member

rwjblue commented Apr 5, 2016

Thank you for the issue and reproduction! Would you mind submitting a failing test? That way it will be easier to confirm that we squash it properly...

@rwjblue
Copy link
Member

rwjblue commented Apr 5, 2016

/cc @raytiley

@raytiley
Copy link
Contributor

raytiley commented Apr 5, 2016

This is because your remapping perPage to per_page. It seems like the activeTransition has it as the form it shows up in the url, but when the query params are finalized it puts them as they appear on the controller.

Still need to work through this a bit more to see what the correct solution is. I'll at least get a failing test written later tonight.

@raytiley
Copy link
Contributor

raytiley commented Apr 7, 2016

This fixes the issue for me: #13273

Still need to write tests / make sure I didn't break anything else.

@pixelhandler
Copy link
Contributor

pixelhandler commented Apr 22, 2016

This past week I started working on a new app, was on Ember 2.4.4 and also tried LTS release 2.4.5, and 2.5.1. The bug persists.

The error I saw is like… "You're not allowed to have more than one controller property map to the same query param key, but both list.index:sortParam and list.index:sortParam map to sort." There is only one controller in the app with the queryParams set the list.index controller.

Using Ember 2.4.3 does not have the Error.

My config uses a baseUrl baseURL: '/tool/list/'

And the router is like…

Router.map(function() {
  this.route('list', { path: '/' }, function () {
    this.route('index', { path: '/' });
  });
});

And, the IndexRoute does have an action that requires a refresh after a queryParam value changes.

@pixelhandler
Copy link
Contributor

pixelhandler commented May 10, 2016

@rwjblue will the fix for this issue be applied to the LTS release ? (we're using 2.4.3 for now since we can't use 2.4.5 with this bug)

@pixelhandler
Copy link
Contributor

@rwjblue @chancancode any update on resolution for LTS version yet?

@jcbvm
Copy link

jcbvm commented Jun 5, 2016

Seems like 2.4.3 is also affected by this, or at least I'm getting the same error.

@pixelhandler
Copy link
Contributor

pixelhandler commented Jun 7, 2016

@jcbvm I've only seen the issue affecting versions 2.4.4 and 2.4.5, rolling back to 2.4.3 was my workaround.

Also, just yesterday a tag was released https://github.com/emberjs/ember.js/releases/tag/v2.4.6 so maybe that is the path forward to stay on the LTS version

@pixelhandler
Copy link
Contributor

Perhaps this issue can be closed not that v2.4.6 has been cut, see: #13600

@pixelhandler
Copy link
Contributor

I'll close this out since 2.4.6 fixes the issue by reverting

@Turbo87
Copy link
Member

Turbo87 commented Sep 20, 2017

FWIW I'm still seeing a similar error with Ember 2.4.6 when I have two routes with identical query params and one route is redirecting to the other and overriding the query params in the transition options 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants