Skip to content

Commit 39d5d79

Browse files
fix(workflow-changes): changes detected in autolayout (#2313)
1 parent 3db8f82 commit 39d5d79

File tree

2 files changed

+39
-6
lines changed

2 files changed

+39
-6
lines changed

apps/sim/lib/logs/execution/snapshot/service.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,17 @@ export class SnapshotService implements ISnapshotService {
146146
const normalizedBlocks: Record<string, any> = {}
147147

148148
for (const [blockId, block] of Object.entries(state.blocks || {})) {
149-
// Skip position as it doesn't affect functionality
150-
const { position, ...blockWithoutPosition } = block
149+
const { position, layout, height, ...blockWithoutLayoutFields } = block
150+
151+
// Also exclude width/height from data object (container dimensions from autolayout)
152+
const {
153+
width: _dataWidth,
154+
height: _dataHeight,
155+
...dataRest
156+
} = blockWithoutLayoutFields.data || {}
151157

152158
// Handle subBlocks with detailed comparison (same as hasWorkflowChanged)
153-
const subBlocks = blockWithoutPosition.subBlocks || {}
159+
const subBlocks = blockWithoutLayoutFields.subBlocks || {}
154160
const normalizedSubBlocks: Record<string, any> = {}
155161

156162
for (const [subBlockId, subBlock] of Object.entries(subBlocks)) {
@@ -168,7 +174,8 @@ export class SnapshotService implements ISnapshotService {
168174
}
169175

170176
normalizedBlocks[blockId] = {
171-
...blockWithoutPosition,
177+
...blockWithoutLayoutFields,
178+
data: dataRest,
172179
subBlocks: normalizedSubBlocks,
173180
}
174181
}

apps/sim/lib/workflows/utils.ts

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,22 +255,48 @@ export function hasWorkflowChanged(
255255
const currentBlock = currentState.blocks[blockId]
256256
const deployedBlock = deployedState.blocks[blockId]
257257

258-
// Destructure and exclude non-functional fields
259-
const { position: _currentPos, subBlocks: currentSubBlocks = {}, ...currentRest } = currentBlock
258+
// Destructure and exclude non-functional fields:
259+
// - position: visual positioning only
260+
// - subBlocks: handled separately below
261+
// - layout: contains measuredWidth/measuredHeight from autolayout
262+
// - height: block height measurement from autolayout
263+
const {
264+
position: _currentPos,
265+
subBlocks: currentSubBlocks = {},
266+
layout: _currentLayout,
267+
height: _currentHeight,
268+
...currentRest
269+
} = currentBlock
260270

261271
const {
262272
position: _deployedPos,
263273
subBlocks: deployedSubBlocks = {},
274+
layout: _deployedLayout,
275+
height: _deployedHeight,
264276
...deployedRest
265277
} = deployedBlock
266278

279+
// Also exclude width/height from data object (container dimensions from autolayout)
280+
const {
281+
width: _currentDataWidth,
282+
height: _currentDataHeight,
283+
...currentDataRest
284+
} = currentRest.data || {}
285+
const {
286+
width: _deployedDataWidth,
287+
height: _deployedDataHeight,
288+
...deployedDataRest
289+
} = deployedRest.data || {}
290+
267291
normalizedCurrentBlocks[blockId] = {
268292
...currentRest,
293+
data: currentDataRest,
269294
subBlocks: undefined,
270295
}
271296

272297
normalizedDeployedBlocks[blockId] = {
273298
...deployedRest,
299+
data: deployedDataRest,
274300
subBlocks: undefined,
275301
}
276302

0 commit comments

Comments
 (0)