mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-13 17:08:01 -05:00
Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c35b1c45f1 | ||
|
|
7bf3d73ee6 | ||
|
|
7ffc11a738 | ||
|
|
be578e2ed7 | ||
|
|
f415e5edc4 | ||
|
|
13a6e6c3fa | ||
|
|
f5ab7f21ae | ||
|
|
bfb6fffe38 | ||
|
|
4fbec0a43f | ||
|
|
585f5e365b | ||
|
|
3792bdd252 | ||
|
|
eb5d1f3e5b | ||
|
|
54ab82c8dd | ||
|
|
f895bf469b | ||
|
|
dd3209af06 | ||
|
|
b6ba3b50a7 | ||
|
|
b304233062 | ||
|
|
57e4b49bd6 | ||
|
|
e12dd204ed | ||
|
|
3d9d9cbc54 | ||
|
|
0f4ec962ad | ||
|
|
4827866f9a | ||
|
|
3e697d9ed9 | ||
|
|
4431a1a484 | ||
|
|
4d1a9a3f22 | ||
|
|
eb07a080fb |
@@ -24,7 +24,9 @@ export function hasWorkflowChanged(
|
||||
deployedState: WorkflowState | null
|
||||
): boolean {
|
||||
// If no deployed state exists, then the workflow has changed
|
||||
if (!deployedState) return true
|
||||
if (!deployedState) {
|
||||
return true
|
||||
}
|
||||
|
||||
// 1. Compare edges (connections between blocks)
|
||||
const currentEdges = currentState.edges || []
|
||||
|
||||
@@ -95,19 +95,41 @@ export const useOperationQueueStore = create<OperationQueueState>((set, get) =>
|
||||
return
|
||||
}
|
||||
|
||||
// Enhanced duplicate content check - especially important for block operations
|
||||
const duplicateContent = state.operations.find(
|
||||
(op) =>
|
||||
op.operation.operation === operation.operation.operation &&
|
||||
op.operation.target === operation.operation.target &&
|
||||
op.workflowId === operation.workflowId &&
|
||||
// For block operations, check the block ID specifically
|
||||
((operation.operation.target === 'block' &&
|
||||
op.operation.payload?.id === operation.operation.payload?.id) ||
|
||||
// For other operations, fall back to full payload comparison
|
||||
(operation.operation.target !== 'block' &&
|
||||
JSON.stringify(op.operation.payload) === JSON.stringify(operation.operation.payload)))
|
||||
)
|
||||
// Enhanced duplicate content check - especially important for block and edge operations
|
||||
const duplicateContent = state.operations.find((op) => {
|
||||
if (
|
||||
op.operation.operation !== operation.operation.operation ||
|
||||
op.operation.target !== operation.operation.target ||
|
||||
op.workflowId !== operation.workflowId
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
// For block operations, check the block ID specifically
|
||||
if (operation.operation.target === 'block') {
|
||||
return op.operation.payload?.id === operation.operation.payload?.id
|
||||
}
|
||||
|
||||
// For edge operations (batch-add-edges), check by source→target connection
|
||||
// This prevents duplicate edges with different IDs but same connection
|
||||
if (
|
||||
operation.operation.target === 'edges' &&
|
||||
operation.operation.operation === 'batch-add-edges'
|
||||
) {
|
||||
const newEdges = operation.operation.payload?.edges || []
|
||||
const existingEdges = op.operation.payload?.edges || []
|
||||
// Check if any new edge has the same source→target as an existing operation's edges
|
||||
return newEdges.some((newEdge: any) =>
|
||||
existingEdges.some(
|
||||
(existingEdge: any) =>
|
||||
existingEdge.source === newEdge.source && existingEdge.target === newEdge.target
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// For other operations, fall back to full payload comparison
|
||||
return JSON.stringify(op.operation.payload) === JSON.stringify(operation.operation.payload)
|
||||
})
|
||||
|
||||
const isReplaceStateWorkflowOp =
|
||||
operation.operation.target === 'workflow' && operation.operation.operation === 'replace-state'
|
||||
|
||||
Reference in New Issue
Block a user