fix(workflow-changes): changes detected in autolayout (#2313)

This commit is contained in:
Vikhyath Mondreti
2025-12-11 12:45:48 -08:00
committed by GitHub
parent 3db8f82449
commit 39d5d797ec
2 changed files with 39 additions and 6 deletions

View File

@@ -146,11 +146,17 @@ export class SnapshotService implements ISnapshotService {
const normalizedBlocks: Record<string, any> = {}
for (const [blockId, block] of Object.entries(state.blocks || {})) {
// Skip position as it doesn't affect functionality
const { position, ...blockWithoutPosition } = block
const { position, layout, height, ...blockWithoutLayoutFields } = block
// Also exclude width/height from data object (container dimensions from autolayout)
const {
width: _dataWidth,
height: _dataHeight,
...dataRest
} = blockWithoutLayoutFields.data || {}
// Handle subBlocks with detailed comparison (same as hasWorkflowChanged)
const subBlocks = blockWithoutPosition.subBlocks || {}
const subBlocks = blockWithoutLayoutFields.subBlocks || {}
const normalizedSubBlocks: Record<string, any> = {}
for (const [subBlockId, subBlock] of Object.entries(subBlocks)) {
@@ -168,7 +174,8 @@ export class SnapshotService implements ISnapshotService {
}
normalizedBlocks[blockId] = {
...blockWithoutPosition,
...blockWithoutLayoutFields,
data: dataRest,
subBlocks: normalizedSubBlocks,
}
}

View File

@@ -255,22 +255,48 @@ export function hasWorkflowChanged(
const currentBlock = currentState.blocks[blockId]
const deployedBlock = deployedState.blocks[blockId]
// Destructure and exclude non-functional fields
const { position: _currentPos, subBlocks: currentSubBlocks = {}, ...currentRest } = currentBlock
// Destructure and exclude non-functional fields:
// - position: visual positioning only
// - subBlocks: handled separately below
// - layout: contains measuredWidth/measuredHeight from autolayout
// - height: block height measurement from autolayout
const {
position: _currentPos,
subBlocks: currentSubBlocks = {},
layout: _currentLayout,
height: _currentHeight,
...currentRest
} = currentBlock
const {
position: _deployedPos,
subBlocks: deployedSubBlocks = {},
layout: _deployedLayout,
height: _deployedHeight,
...deployedRest
} = deployedBlock
// Also exclude width/height from data object (container dimensions from autolayout)
const {
width: _currentDataWidth,
height: _currentDataHeight,
...currentDataRest
} = currentRest.data || {}
const {
width: _deployedDataWidth,
height: _deployedDataHeight,
...deployedDataRest
} = deployedRest.data || {}
normalizedCurrentBlocks[blockId] = {
...currentRest,
data: currentDataRest,
subBlocks: undefined,
}
normalizedDeployedBlocks[blockId] = {
...deployedRest,
data: deployedDataRest,
subBlocks: undefined,
}