diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value.ts index 3acc8a553..f8b432625 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value.ts @@ -210,11 +210,9 @@ export function useSubBlockValue( ) // Determine the effective value: diff value takes precedence if in diff mode - const effectiveValue = hasSnapshotValue - ? snapshotValue - : storeValue !== undefined - ? storeValue - : initialValue + // Use nullish coalescing to fall back to initialValue when storeValue is null or undefined + // This handles the case where a block is newly added and the subblock store hasn't been populated yet + const effectiveValue = hasSnapshotValue ? snapshotValue : (storeValue ?? initialValue) // Initialize valueRef on first render useEffect(() => {