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

Unexpected values of queryParams on a controller using decorators #78

Closed
jonopus opened this issue Mar 4, 2019 · 0 comments
Closed

Comments

@jonopus
Copy link

jonopus commented Mar 4, 2019

I'm seeing unexpected values of queryParams on a controller using decorators.

Steps to reproduce:

  1. Add the following init method to tests/dummy/app/controllers/index.js.
init(){
  this._super(...arguments);
  console.log(this.get('queryParams'));
}
  1. Serve the app
    #. Notice in the console that queryParams is an array of hashes rather than an array or a hash.
[
  {"parachuteOpen":{"as":"parachute"}},
  {"parachuteOpen":{"as":"parachute"},"page":{"as":"page"}},
  {"parachuteOpen":{"as":"parachute"},"page":{"as":"page"},"search":{"as":"search"}},
  {"parachuteOpen":{"as":"parachute"},"page":{"as":"page"},"search":{"as":"search"},"tags":{"as":"tags"}}
]

I would have expected this value to be in one of the following formats:
[ "parachuteOpen", "page", "search", "tags" ]
{"parachuteOpen":{"as":"parachute"},"page":{"as":"page"},"search":{"as":"search"},"tags":{"as":"tags"}}

I believe this is cause when each decorator adds an additional init call.
One possible solution might be to guard against calling init multiple times.

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

No branches or pull requests

1 participant