减少编辑器历史快照复制
提交历史时复用已克隆的 nextState,避免每次编辑产生冗余深拷贝
This commit is contained in:
@@ -567,7 +567,7 @@ export function useUiEditorState(initialState: State = EMPTY_UI_EDITOR_STATE) {
|
||||
if (sameResource(current, nextState)) return false;
|
||||
undoStackRef.current.push({
|
||||
before: cloneState(current),
|
||||
after: cloneState(nextState),
|
||||
after: nextState,
|
||||
});
|
||||
if (undoStackRef.current.length > MAX_HISTORY_LENGTH) {
|
||||
undoStackRef.current.shift();
|
||||
|
||||
Reference in New Issue
Block a user