问题描述
在我的应用程序中,我收到了有关对象已更改的 websockects 信息,并且 ember 数据应重新加载它们.
In my aplication I recived with websockects info about with objects are changed and ember data should reload them.
如何强制 emberdata 更新已加载的记录?如何强制 emberdata 从服务器知道某些记录已经删除?
How can I force emberdata to update already loaded record?How can I force emberdata to get know from server that some records are already delted?
推荐答案
我能找到的唯一方法是使用 json 手动触发 App.store.loadMany(data)
(如果有),或执行 App.store.findQuery(App.Model, {})
,这将使您的缓存无效.
The only way I could find to achieve something like this is to trigger manually App.store.loadMany(data)
with the json (if you have it), or performing a App.store.findQuery(App.Model, {})
, which will invalidate your cache.
几天前我在 ember 上打开了一个问题来询问这个问题:
I opened an issue a few days ago on ember to ask about this:
https://github.com/emberjs/data/issues/245
似乎他们正在研究这种情况 - ember/data 还很年轻!
It seems like they're working on this case scenarios - ember/data is still quite young!
这篇关于如何使用 ember 数据刷新实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!