@@ -804,7 +804,7 @@ export function useCollaborativeWorkflow() {
804804 )
805805
806806 const collaborativeSetSubblockValue = useCallback (
807- ( blockId : string , subblockId : string , value : any ) => {
807+ ( blockId : string , subblockId : string , value : any , options ?: { _visited ?: Set < string > } ) => {
808808 if ( isApplyingRemoteChange . current ) return
809809
810810 // Skip socket operations when in diff mode
@@ -843,6 +843,9 @@ export function useCollaborativeWorkflow() {
843843
844844 // Declarative clearing: clear sub-blocks that depend on this subblockId
845845 try {
846+ const visited = options ?. _visited || new Set < string > ( )
847+ if ( visited . has ( subblockId ) ) return
848+ visited . add ( subblockId )
846849 const blockType = useWorkflowStore . getState ( ) . blocks ?. [ blockId ] ?. type
847850 const blockConfig = blockType ? getBlock ( blockType ) : null
848851 if ( blockConfig ?. subBlocks && Array . isArray ( blockConfig . subBlocks ) ) {
@@ -852,7 +855,8 @@ export function useCollaborativeWorkflow() {
852855 for ( const dep of dependents ) {
853856 // Skip clearing if the dependent is the same field
854857 if ( ! dep ?. id || dep . id === subblockId ) continue
855- subBlockStore . setValue ( blockId , dep . id , '' )
858+ // Cascade using the same collaborative path so it emits and further cascades
859+ collaborativeSetSubblockValue ( blockId , dep . id , '' , { _visited : visited } )
856860 }
857861 }
858862 } catch {
0 commit comments