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

route queryParams support #235

Closed
jamesarosen opened this issue May 17, 2018 · 3 comments
Closed

route queryParams support #235

jamesarosen opened this issue May 17, 2018 · 3 comments

Comments

@jamesarosen
Copy link

jamesarosen commented May 17, 2018

If I do this in a route

export default MyRoute extends Route {
  queryParams = { foo: { refreshModel: true } }
}

then calling transitionTo(currentRoute, { queryParams: { foo: 'new-foo' } }) doesn't work. (In my tests, it seems to work on every other invocation, oddly.)

This works:

export default MyRoute extends Route {
  init() {
    super.init(...arguments)
    this.set('queryParams', { foo: { refreshModel: true } })
  }
}

as does this:

export default MyRoute extends Route {
  @computed // or without @computed
  get queryParams() {
    return { foo: { refreshModel: true } }
  }
}

This doesn't work:

export default MyRoute extends Route {
  constructor() {
    super()
    this.set('queryParams', { foo: { refreshModel: true } })
  }
}

because serializeQueryParam throws a null-pointer exception here trying to call this._router._serializeQueryParam(value, defaultValueType);

@pzuraq
Copy link
Contributor

pzuraq commented Jun 15, 2018

@jamesarosen I haven't been able to dig into this so far, but according to folks in the Typescript channel that I've talked to they've been able to use QPs by using class field assignment. I have a feeling the issues you're encountering may also be fixed by the changes proposed in RFC 337 as well.

Can you produce a test case or example of the failure?

@jamesarosen
Copy link
Author

I suspect this is exactly what RFC 337 addresses.

@pzuraq
Copy link
Contributor

pzuraq commented Oct 2, 2018

This has been addressed in RFC337, the implementation of which has been merged and should be released soon

@pzuraq pzuraq closed this as completed Oct 2, 2018
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

2 participants