Is it a good practice if I change route.render() by tracking QP's changes?


#1

I’ve had a design idea to make different route.render() calls by tracking QP’s changes, basically it looks like this:

// In one route class
queryParamsDidChange(queryParams) {
    if (queryParams.type) {
        this.render(`cards/new/${queryParams.type}`, { into: 'cards/new' })
    }
}

This did works, only with a bug: when you manually refresh this page, Ember will throw an error which I have not find a solution yet.

It leads me to a question: is this a bad idea that Ember totally doesn’t agree, or it is fine but Ember can’t handle it perfectly? Anyone can share some experiences on this case? Thanks in advance.