Skip to content

Commit 689037a

Browse files
fix(canonical): copilot path + update parent (#2901)
1 parent 07f0c01 commit 689037a

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

apps/sim/app/api/workflows/[id]/state/route.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const BlockDataSchema = z.object({
3333
doWhileCondition: z.string().optional(),
3434
parallelType: z.enum(['collection', 'count']).optional(),
3535
type: z.string().optional(),
36+
canonicalModes: z.record(z.enum(['basic', 'advanced'])).optional(),
3637
})
3738

3839
const SubBlockStateSchema = z.object({

apps/sim/hooks/use-collaborative-workflow.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,17 @@ export function useCollaborativeWorkflow() {
897897
// Collect all edge IDs to remove
898898
const edgeIdsToRemove = updates.flatMap((u) => u.affectedEdges.map((e) => e.id))
899899
if (edgeIdsToRemove.length > 0) {
900+
const edgeOperationId = crypto.randomUUID()
901+
addToQueue({
902+
id: edgeOperationId,
903+
operation: {
904+
operation: EDGES_OPERATIONS.BATCH_REMOVE_EDGES,
905+
target: OPERATION_TARGETS.EDGES,
906+
payload: { ids: edgeIdsToRemove },
907+
},
908+
workflowId: activeWorkflowId || '',
909+
userId: session?.user?.id || 'unknown',
910+
})
900911
useWorkflowStore.getState().batchRemoveEdges(edgeIdsToRemove)
901912
}
902913

apps/sim/socket/database/operations.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,11 @@ async function handleBlockOperationTx(
337337
const currentData = currentBlock?.data || {}
338338

339339
// Update data with parentId and extent
340+
const { parentId: _removedParentId, extent: _removedExtent, ...restData } = currentData
340341
const updatedData = isRemovingFromParent
341-
? {} // Clear data entirely when removing from parent
342+
? restData
342343
: {
343-
...currentData,
344+
...restData,
344345
...(payload.parentId ? { parentId: payload.parentId } : {}),
345346
...(payload.extent ? { extent: payload.extent } : {}),
346347
}
@@ -828,10 +829,11 @@ async function handleBlocksOperationTx(
828829

829830
const currentData = currentBlock?.data || {}
830831

832+
const { parentId: _removedParentId, extent: _removedExtent, ...restData } = currentData
831833
const updatedData = isRemovingFromParent
832-
? {}
834+
? restData
833835
: {
834-
...currentData,
836+
...restData,
835837
...(parentId ? { parentId, extent: 'parent' } : {}),
836838
}
837839

0 commit comments

Comments
 (0)