* fix: index

* fix: snapshot error; perf: snapshot diff compare

* perf: init simple edit history
This commit is contained in:
Archer
2024-11-21 16:26:43 +08:00
committed by GitHub
parent 9b2c3b242a
commit 019bf67e2d
11 changed files with 220 additions and 170 deletions

View File

@@ -8,11 +8,14 @@ const createWorkflowDiffPatcher = () =>
const diffPatcher = createWorkflowDiffPatcher();
export const createDiff = <T extends Record<string, unknown>>(initialState?: T, newState?: T) => {
export const getAppDiffConfig = <T extends Record<string, unknown>>(
initialState?: T,
newState?: T
) => {
return diffPatcher.diff(initialState, newState);
};
export const applyDiff = <T extends Record<string, unknown>>(
export const getAppConfigByDiff = <T extends Record<string, unknown>>(
initialState?: T,
diff?: ReturnType<typeof diffPatcher.diff>
) => {

View File

@@ -633,12 +633,11 @@ export const compareSnapshot = (
};
// remove node size
export const simplifyNodes = (nodes: Node[]) => {
export const simplifyWorkflowNodes = (nodes: Node[]) => {
return nodes.map((node) => ({
id: node.id,
type: node.type,
position: node.position,
data: node.data,
zIndex: node.zIndex
data: node.data
}));
};