简体   繁体   English

强制Ember-Data重新加载上的findTo / hasManyTo / hasMany关系

[英]Force Ember-Data to reload belongsTo/hasMany relationships on find

How can I tell ember-data to also reload the related entities? 如何告诉ember-data也重新加载相关实体?

When I run the the following for the second time it will nicely reload the posts, but will not reload the belongs/hasMany relationships (Which were loaded on the first time). 当我第二次运行以下命令时,它将很好地重新加载帖子,但不会重新加载归属/ hasMany关系(第一次加载哪个)。

model: function() {
    return this.store.findAll('posts',{reload:true});
},

I know there are many scenarios where this is wanted, but in my scenario the related entities can have changed. 我知道在很多情况下都需要这样做,但是在我的情况下,相关实体可能已更改。

Implement a socket.io service notifiying me of changes isn't an option as I don't have enough control of the server. 由于我没有足够的服务器控制权,因此无法实现通知我更改的socket.io服务。

Note: I'm on Ember 2.0.0 and Ember-Data Canary 注意:我使用的是Ember 2.0.0和Ember-Data Canary

There seems to be no inbuilt solution, only workarounds. 似乎没有内置的解决方案,只有解决方法。

eg call 例如打电话

store.unloadAll('typeOfRelationship');

before calling findAll 在调用findAll之前

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM