diff --git a/src/lib/data-access/store/sessionSlice.ts b/src/lib/data-access/store/sessionSlice.ts index 045f0965f4da342e82b8f03aca70aa63fcc51622..a1f57fb4951b453366b3ba7c4744373d58e1d573 100644 --- a/src/lib/data-access/store/sessionSlice.ts +++ b/src/lib/data-access/store/sessionSlice.ts @@ -342,25 +342,43 @@ export const selectQuerybuilderHash = (state: RootState): string => { return ''; // Return an empty string if no active graph exists } - const hashedNodes = activeQuery.graph.nodes.map(n => { - const node = { ...n }; - if (n?.attributes) { - const newAttributes = { ...n?.attributes }; - newAttributes.x = 0; - newAttributes.y = 0; - newAttributes.height = 0; - newAttributes.width = 0; - node.attributes = newAttributes; - } - return node; - }); + function isEmptyLogicPill(node: any) { + if (node == null || node.attributes.inputs == null) return false; + const input = Object.values(node.attributes.inputs)[0]; + return node.attributes.type == 'logic' && input != null && input == node.attributes.logic.input.default; + } + + const hashedNodes = activeQuery.graph.nodes + .filter(n => { + if (isEmptyLogicPill(n)) return false; + return true; + }) + .map(n => { + const node = { ...n }; + if (n?.attributes) { + const newAttributes = { ...n?.attributes }; + newAttributes.x = 0; + newAttributes.y = 0; + newAttributes.height = 0; + newAttributes.width = 0; + node.attributes = newAttributes; + } + return node; + }); + const ret = { nodes: hashedNodes, - edges: activeQuery.graph.edges.map(n => ({ - key: n.key, - source: n.source, - target: n.target, - })), + edges: activeQuery.graph.edges + .filter(e => { + const targetNode = activeQuery.graph.nodes.find(n => n.key == e.target); + if (isEmptyLogicPill(targetNode)) return false; + return true; + }) + .map(n => ({ + key: n.key, + source: n.source, + target: n.target, + })), attributesBeingShown: activeQuery.attributesBeingShown, settings: activeQuery.settings, };