-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
toJSON({ diff: true })没有达到预期效果 #4297
Comments
Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. |
@Lmangoxx 是返回了剔除默认属性的数据,这句“是否返回与默认值相比具有差异的那些数据”这句话模棱两可 if (key !== 'attrs' && key !== 'shape' && diff) {
const preset = defaults[key]
if (ObjectExt.isEqual(val, preset)) {
delete props[key]
}
} |
我觉得toJSON(...)这里想表达的是1吧,因为有说“将节点/边的结构化数据转换为 JSON 数据,以便做持久化存储(通常我们通过调用 graph.toJSON 来导出整个画布的数据)。” |
Describe the bug
官方文档里diff功能说明:是否返回与默认值相比具有差异的那些数据。
画布初始化fromJSON数据后,修改node位置或者新增node后,执行toJSON({ diff: true })并没有返回差异数据,返回的是完整的画布数据,是我哪里使用的不对吗?还是有什么条件限制
Your Example Website or App
https://stackblitz.com/edit/vitejs-vite-fhnajx?file=src%2FApp.jsx
Steps to Reproduce the Bug or Issue
Expected behavior
期望返回修改的差异数据
Screenshots or Videos
No response
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: