@@ -533,7 +533,7 @@ component output="true" accessors="true" {
533533 if ( ! variables ._event .privateValueExists ( " _cbwire_stream" ) ) {
534534 cfcontent ( reset = true );
535535 variables ._event .setPrivateValue ( " _cbwire_stream" , true );
536- cfheader ( statusCode = 200 , statustext = " OK " );
536+ cfheader ( statusCode = 200 );
537537 cfheader ( name = " Cache-Control" , value = " no-cache, private" );
538538 cfheader ( name = " Host" , value = cgi .http_host );
539539 cfheader ( name = " Content-Type" , value = " text/event-stream" );
@@ -793,24 +793,31 @@ component output="true" accessors="true" {
793793 local .regexMatch = reFindNoCase ( " (.+)\.([0-9]+)" , arguments .key , 1 , true );
794794 local .propertyName = local .regexMatch .match [ 2 ];
795795 local .arrayIndex = local .regexMatch .match [ 3 ];
796- variables .data [ local .propertyName ][ local .arrayIndex + 1 ] = isNumeric ( arguments .value ) ? val ( arguments .value ) : arguments .value ;
797- // Track that we updated an array property
796+ local .currentArray = structGet ( " variables.data." & local .propertyName );
797+ local .currentArray [ local .arrayIndex + 1 ] = isNumeric ( arguments .value ) ? val ( arguments .value ) : arguments .value ;
798+ _updateDataValue ( local .propertyName , local .currentArray );
799+ // Track that we updated an array property
798800 if ( ! arrayFindNoCase ( updatedArrayProps , local .propertyName ) ) {
799801 updatedArrayProps .append ( local .propertyName );
800802 }
801803 } else {
802- local .oldValue = variables .data [ key ];
803- variables .data [ key ] = arguments .value ;
804- if ( structKeyExists ( this , " onUpdate#key #" ) ) {
805- invoke ( this , " onUpdate#key #" , { value : arguments .value , oldValue : local .oldValue });
804+ local .oldValue = structGet ( " variables.data." & key );
805+ _updateDataValue ( key , arguments .value );
806+ var onUpdateFunctionName = " onUpdate" & key .replace ( " ." , " _" , " all" );
807+ if ( structKeyExists ( this , onUpdateFunctionName ) ) {
808+ invoke ( this , onUpdateFunctionName , { value : arguments .value , oldValue : local .oldValue });
806809 }
807810 }
808811 } );
809812
810813 local .updatedArrayProps .each ( function ( prop ) {
811- variables .data [ arguments .prop ] = variables .data [ arguments .prop ].filter ( function ( value ) {
812- return arguments .value ! = " __rm__" ;
813- } );
814+ var currentArray = structGet ( " variables.data." & prop );
815+ _updateDataValue (
816+ prop ,
817+ currentArray .filter ( function ( value ) {
818+ return value ! = " __rm__" ;
819+ } )
820+ );
814821 } );
815822
816823 // Call onUpdate passing newValues and oldValues
@@ -819,6 +826,30 @@ component output="true" accessors="true" {
819826 }
820827 }
821828
829+ /**
830+ * update a key value in variables.data structure.
831+ *
832+ * @keyPath string | the data property key being updated. Supports dot notation for nested structures (e.g., "user.address.street").
833+ * @value any | the value to set.
834+ *
835+ * @return void
836+ */
837+ public void function _updateDataValue ( required string keyPath , required any value ) {
838+ var key s = ListToArray ( arguments .key Path , " ." );
839+ var current = variables .data ;
840+ // Loop through keys except the last one to create/traverse nested structure
841+ for ( var i = 1 ; i < key s .Len (); i ++ ) {
842+ var key = keys [ i ];
843+ // Create nested struct if it doesn't exist
844+ if ( ! current .KeyExists ( key ) ) {
845+ current [ key ] = {};
846+ }
847+ // Move to the next level
848+ current = current [ key ];
849+ }
850+ current [ keys [ key s .Len () ] ] = arguments .value ;
851+ }
852+
822853 /**
823854 * Validate if key being updated is a locked property.
824855 *
@@ -948,7 +979,7 @@ component output="true" accessors="true" {
948979 );
949980 // Check if the component has an onUploadError method and invoke it
950981 if ( structKeyExists ( this , " onUploadError" ) ) {
951- invoke ( this , " onUploadError" , {
982+ invoke ( this , " onUploadError" , {
952983 property : arguments .prop ,
953984 errors : arguments .errors ,
954985 multiple : arguments .multiple
0 commit comments