Why isLoaded store alias has been removed?


#1

First of all, thanks to everybody for their work on ember.

I’ve some questions here, and I’m not complaining at all :wink:

In this commit @tomdale removed isLoaded store alias : https://github.com/emberjs/data/commit/efe6d206c9105d84cd0961ec1275ee6b9c850bc3

@sly7_7 and @tchak seems worried about it to.

In this issue I exposed a use case and @pwagenet asked me to start a new topic here : https://github.com/emberjs/data/issues/1018

Here it is :

I think isLoaded store alias deserve to be available, particulary in the following use case.

I’m building an app that displays data that can be updated through websockets, but I don’t manage update the same way if the updated model is already loaded or not. :

App.socket.on('updateIssue', function (issueId) {
  if (App.Issue.isLoaded(issueId)) {
    //do this
  }
  else {
    //do that, eventually App.Issue.find(issueId)...
  }
});

But maybe isLoaded alias is planned to be back ? And also, maybe my approach is wrong…

So the main questions here are :

  1. Why has been the alias removed, and why can’t it be back ?
  2. Is my approach right, and how can I get the same pattern without isLoaded alias (and without add it myself to ember-data).

#2

@wycats might have some insight too.


#3

We are working on adding this back in the next version of Ember Data with cleaner semantics.


#4

Great news! Thanks @tomdale