Skip to content

Commit f8264c3

Browse files
fix: close socket sync review gaps
1 parent 9351a9d commit f8264c3

File tree

3 files changed

+4
-30
lines changed

3 files changed

+4
-30
lines changed

apps/sim/socket/database/operations.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -92,34 +92,6 @@ function findDbDescendants(containerId: string, allBlocks: DbBlockRef[]): string
9292
return descendants
9393
}
9494

95-
/**
96-
* Shared function to handle auto-connect edge insertion
97-
* @param tx - Database transaction
98-
* @param workflowId - The workflow ID
99-
* @param autoConnectEdge - The auto-connect edge data
100-
* @param logger - Logger instance
101-
*/
102-
async function insertAutoConnectEdge(
103-
tx: any,
104-
workflowId: string,
105-
autoConnectEdge: any,
106-
logger: any
107-
) {
108-
if (!autoConnectEdge) return
109-
110-
await tx.insert(workflowEdges).values({
111-
id: autoConnectEdge.id,
112-
workflowId,
113-
sourceBlockId: autoConnectEdge.source,
114-
targetBlockId: autoConnectEdge.target,
115-
sourceHandle: autoConnectEdge.sourceHandle || null,
116-
targetHandle: autoConnectEdge.targetHandle || null,
117-
})
118-
logger.debug(
119-
`Added auto-connect edge ${autoConnectEdge.id}: ${autoConnectEdge.source} -> ${autoConnectEdge.target}`
120-
)
121-
}
122-
12395
enum SubflowType {
12496
LOOP = 'loop',
12597
PARALLEL = 'parallel',

apps/sim/socket/handlers/operations.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ describe('setupOperationsHandlers', () => {
123123
timestamp: expect.any(Number),
124124
userId: 'user-1',
125125
})
126-
expect(socketRoomEmit).toHaveBeenCalledWith(
126+
expect(emitToWorkflow).toHaveBeenNthCalledWith(
127+
1,
128+
'workflow-1',
127129
'workflow-operation',
128130
expect.objectContaining({
129131
operation: EDGES_OPERATIONS.BATCH_REMOVE_EDGES,

apps/sim/socket/handlers/operations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ export function setupOperationsHandlers(socket: AuthenticatedSocket, roomManager
503503

504504
// Broadcast edge removals if the parent update cleaned up boundary edges
505505
if (result?.removedEdgeIds && result.removedEdgeIds.length > 0) {
506-
socket.to(workflowId).emit('workflow-operation', {
506+
roomManager.emitToWorkflow(workflowId, 'workflow-operation', {
507507
operation: EDGES_OPERATIONS.BATCH_REMOVE_EDGES,
508508
target: OPERATION_TARGETS.EDGES,
509509
payload: { ids: result.removedEdgeIds },

0 commit comments

Comments
 (0)