减少编辑器历史快照复制

提交历史时复用已克隆的 nextState,避免每次编辑产生冗余深拷贝
This commit is contained in:
2026-09-03 13:15:01 +08:00
parent 071998fee9
commit cb86ab8be9
@@ -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();