@@ -1243,6 +1243,21 @@ export function useCollaborativeWorkflow() {
12431243 // ALWAYS update local store first for immediate UI feedback
12441244 useSubBlockStore . getState ( ) . setValue ( blockId , subblockId , value )
12451245
1246+ if ( activeWorkflowId ) {
1247+ const operationId = crypto . randomUUID ( )
1248+
1249+ addToQueue ( {
1250+ id : operationId ,
1251+ operation : {
1252+ operation : SUBBLOCK_OPERATIONS . UPDATE ,
1253+ target : OPERATION_TARGETS . SUBBLOCK ,
1254+ payload : { blockId, subblockId, value } ,
1255+ } ,
1256+ workflowId : activeWorkflowId ,
1257+ userId : session ?. user ?. id || 'unknown' ,
1258+ } )
1259+ }
1260+
12461261 // Handle dependent subblock clearing (recursive calls)
12471262 try {
12481263 const visited = options ?. _visited || new Set < string > ( )
@@ -1256,34 +1271,20 @@ export function useCollaborativeWorkflow() {
12561271 )
12571272 for ( const dep of dependents ) {
12581273 if ( ! dep ?. id || dep . id === subblockId ) continue
1274+ const currentDepValue = useSubBlockStore . getState ( ) . getValue ( blockId , dep . id )
1275+ if (
1276+ currentDepValue === '' ||
1277+ currentDepValue === null ||
1278+ currentDepValue === undefined
1279+ ) {
1280+ continue
1281+ }
12591282 collaborativeSetSubblockValue ( blockId , dep . id , '' , { _visited : visited } )
12601283 }
12611284 }
12621285 } catch {
12631286 // Best-effort; do not block on clearing
12641287 }
1265-
1266- // Queue socket operation if we have an active workflow
1267- if ( ! activeWorkflowId ) {
1268- logger . debug ( 'Local update applied, skipping socket queue - no active workflow' , {
1269- blockId,
1270- subblockId,
1271- } )
1272- return
1273- }
1274-
1275- const operationId = crypto . randomUUID ( )
1276-
1277- addToQueue ( {
1278- id : operationId ,
1279- operation : {
1280- operation : SUBBLOCK_OPERATIONS . UPDATE ,
1281- target : OPERATION_TARGETS . SUBBLOCK ,
1282- payload : { blockId, subblockId, value } ,
1283- } ,
1284- workflowId : activeWorkflowId ,
1285- userId : session ?. user ?. id || 'unknown' ,
1286- } )
12871288 } ,
12881289 [ activeWorkflowId , addToQueue , session ?. user ?. id , isBaselineDiffView ]
12891290 )
0 commit comments