如果对象已经是同一或另一个状态树的一部分,则无法将对象添加到状态树
mobx-state-tree.module.js?f7d3:2154未接收错误:[mobx-state-tree]如果已经是同一或另一个状态树的一部分,则不能将对象添加到状态树中。
I get this error just by filtering through another state:
const data = self.allData.slice(0, 20);
self.sliced = data
Anyone has any idea what's wrong?
mobx-state-tree.module.js?f7d3:2154 Uncaught Error: [mobx-state-tree] Cannot add an object to a state tree if it is already part of the same or another state tree.
I get this error just by filtering through another state:
const data = self.allData.slice(0, 20);
self.sliced = data
Anyone has any idea what's wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在状态树中不能两次存在节点。取而代之的是,您可以将
切成薄片
数据建模为参考文献 它应该按预期工作。示例
A node cannot exist twice in the state tree. You could instead model your
sliced
data as an array ofreferences
and it should work as expected.Example