Skip to content

Commit c0fe910

Browse files
committed
fix(posthog): use ids.length for block_removed guard to handle container blocks with descendants
1 parent 4081330 commit c0fe910

File tree

1 file changed

+11
-8
lines changed
  • apps/sim/stores/workflows/workflow

1 file changed

+11
-8
lines changed

apps/sim/stores/workflows/workflow/store.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -390,15 +390,18 @@ export const useWorkflowStore = create<WorkflowStore>()(
390390
parallels: generateParallelBlocks(newBlocks),
391391
})
392392

393-
if (removedBlockTypes.length === 1) {
394-
import('@/lib/posthog/client')
395-
.then(({ captureClientEvent }) => {
396-
captureClientEvent('block_removed', {
397-
block_type: removedBlockTypes[0],
398-
workflow_id: get().currentWorkflowId ?? 'unknown',
393+
if (ids.length === 1) {
394+
const blockType = currentBlocks[ids[0]]?.type
395+
if (blockType) {
396+
import('@/lib/posthog/client')
397+
.then(({ captureClientEvent }) => {
398+
captureClientEvent('block_removed', {
399+
block_type: blockType,
400+
workflow_id: get().currentWorkflowId ?? 'unknown',
401+
})
399402
})
400-
})
401-
.catch(() => {})
403+
.catch(() => {})
404+
}
402405
}
403406

404407
get().updateLastSaved()

0 commit comments

Comments
 (0)