I used PerManentuserdata API,
I want to use TypelistToarraysnapshot to calculate YCHANGE for YXMLFRAGMENT instances to calculate the list of user lists of added and removed. I delete the logic of Dispatch to update View.
I just want to know who modified document.
But I found that the typeListToArraySnapshot function will modify editor view after the traversing. I don’t know what happened.
So i use lodash 中的 cloneDeep 方法来对 sync plugin 的state中的type进行克隆,这样确实有时候会好,但是刚刚出现了这样的问题
lodash.js:3093 Uncaught RangeError: Maximum call stack size exceeded
at baseGetAllKeys (lodash.js:3093:1)
at getAllKeys (lodash.js:5916:1)
at baseClone (lodash.js:2726:1)
at lodash.js:2733:1
at arrayEach (lodash.js:530:1)
at baseClone (lodash.js:2727:1)
at lodash.js:2733:1
at arrayEach (lodash.js:530:1)
at baseClone (lodash.js:2727:1)
at lodash.js:2733:1
The following is my code
Y.typeListToArraySnapshot(
cloneDeep(pluginState.type),
new Y.Snapshot(oldSnapshot.ds, curSnapshot.sv)
).map((t) => {
// eslint-disable-next-line no-underscore-dangle
if (!t._item.deleted || isVisible(t._item, curSnapshot) || isVisible(t._item, oldSnapshot)) {
return createNodeFromYElement(
t,
this.editor.view.state.schema,
new Map(),
curSnapshot,
oldSnapshot,
computeYChange
);
}
return null;
});
Maybe it is because YXMLFRAGMENT is too deep, will this have anything to do with the closing of the GC?
I set up GC as false, because I want to capture who deleted data.