Showing
4 changed files
with
7 additions
and
5 deletions
@@ -128,7 +128,7 @@ export function useBasicDataTransform() { | @@ -128,7 +128,7 @@ export function useBasicDataTransform() { | ||
128 | description, | 128 | description, |
129 | name, | 129 | name, |
130 | }, | 130 | }, |
131 | - created: !id?.id, | 131 | + created: !!id?.id, |
132 | }, | 132 | }, |
133 | { | 133 | { |
134 | id: id?.id || buildUUID(), | 134 | id: id?.id || buildUUID(), |
@@ -152,6 +152,7 @@ export function useBasicDataTransform() { | @@ -152,6 +152,7 @@ export function useBasicDataTransform() { | ||
152 | } | 152 | } |
153 | 153 | ||
154 | const newNode = genNewNodeByData(node, nodeConfig); | 154 | const newNode = genNewNodeByData(node, nodeConfig); |
155 | + newNode.data.isSaved = true; | ||
155 | 156 | ||
156 | addNodes.push(newNode); | 157 | addNodes.push(newNode); |
157 | } | 158 | } |
@@ -217,9 +218,10 @@ export function useBasicDataTransform() { | @@ -217,9 +218,10 @@ export function useBasicDataTransform() { | ||
217 | if (ignoreNodeKeys.includes(nodeData.config?.key as string)) continue; | 218 | if (ignoreNodeKeys.includes(nodeData.config?.key as string)) continue; |
218 | 219 | ||
219 | const data = nodeData.data; | 220 | const data = nodeData.data; |
221 | + | ||
220 | const resultNode = Object.assign( | 222 | const resultNode = Object.assign( |
221 | mergeData(data, nodeData, node), | 223 | mergeData(data, nodeData, node), |
222 | - nodeData.created | 224 | + nodeData?.isSaved |
223 | ? ({ | 225 | ? ({ |
224 | id: { id: node.id, entityType: RuleChainEntityType.RULE_NODE }, | 226 | id: { id: node.id, entityType: RuleChainEntityType.RULE_NODE }, |
225 | } as BasicNodeBindData) | 227 | } as BasicNodeBindData) |
@@ -170,7 +170,7 @@ export function useContextMenuAction() { | @@ -170,7 +170,7 @@ export function useContextMenuAction() { | ||
170 | const { getAddNodesParams } = useAddNodes(); | 170 | const { getAddNodesParams } = useAddNodes(); |
171 | const { x, y } = position; | 171 | const { x, y } = position; |
172 | 172 | ||
173 | - const value = getAddNodesParams(position, data, { id }); | 173 | + const value = getAddNodesParams(position, { ...data, isSaved: false }, { id }); |
174 | 174 | ||
175 | setRuleNodeCache({ | 175 | setRuleNodeCache({ |
176 | nodes: [value], | 176 | nodes: [value], |
@@ -50,8 +50,7 @@ export function useSaveAndRedo() { | @@ -50,8 +50,7 @@ export function useSaveAndRedo() { | ||
50 | 50 | ||
51 | const { connections, nodes, firstNodeIndex } = combineData( | 51 | const { connections, nodes, firstNodeIndex } = combineData( |
52 | flowActionType.getNodes, | 52 | flowActionType.getNodes, |
53 | - flowActionType.getEdges, | ||
54 | - true | 53 | + flowActionType.getEdges |
55 | ); | 54 | ); |
56 | 55 | ||
57 | handleSaveRuleChain(connections, nodes, firstNodeIndex, flowActionType); | 56 | handleSaveRuleChain(connections, nodes, firstNodeIndex, flowActionType); |
@@ -138,6 +138,7 @@ export interface NodeData<T = BasicNodeFormData> { | @@ -138,6 +138,7 @@ export interface NodeData<T = BasicNodeFormData> { | ||
138 | config?: NodeItemConfigType; | 138 | config?: NodeItemConfigType; |
139 | data?: T; | 139 | data?: T; |
140 | created?: boolean; | 140 | created?: boolean; |
141 | + isSaved?: boolean; | ||
141 | } | 142 | } |
142 | 143 | ||
143 | export interface EdgeData { | 144 | export interface EdgeData { |