Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4826

How to refresh or modify the result of query

$
0
0

@simonc wrote:

Hi,

I’m currently migrating from Ember v2.15 to v3.1 and I’m facing an issue I don’t really know how to address. In several of my routes, the model is the result of a call to query like this:

model() {
  return this.get('store').query('article', { param1: 42, param2: 123 })
}

The problem is that I want to be able to create or delete items from the returned list:

Error: The result of a server query (…) is immutable.

Apparently now the query result is immutable but I can’t find any solution when searching for this topic.

I found a Github issue were calling .toArray() was proposed but I tried and for some reason it also modifies the records so that they don’t even respond to .get() anymore.

I also tried to call model.reload() without any positive outcome. I tried to transition to the same route but since the parameter did not change the model hook was not called again. The error message does not provide any guidance on how to address this kind of situation and that’s pretty frustating.

Changing the query for a findAll is not an option in this case or I’d do it.

Does anyone know of a clean and reliable way to make all of this work?

Thanks!

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4826

Trending Articles