@@ -360,7 +360,7 @@ private static (Item item, int index) CombineIRAndState(BlockNode blockNode, Err
360360 foreach ( var propIR in blockNode . Properties )
361361 {
362362 // Dynamic properties could be null for the galleryTemplateTemplate
363- var isDynamicProperty = state . DynamicProperties != null &&
363+ var isDynamicProperty = state . DynamicProperties != null &&
364364 ( ( isInResponsiveLayout && DynamicProperties . IsResponsiveLayoutProperty ( propIR . Identifier ) ) ||
365365 // Check if property is dynamic (responsive layout or has metadata like ControlPropertyState)
366366 state . DynamicProperties . Any ( dp => dp . PropertyName == propIR . Identifier ) ) ;
@@ -380,7 +380,15 @@ private static (Item item, int index) CombineIRAndState(BlockNode blockNode, Err
380380 // Add dummy dynamic output props in the state at the end
381381 foreach ( var dynPropState in state . DynamicProperties . Where ( propState => propState . Property == null ) )
382382 {
383- dynamicProperties . Add ( new DynamicPropertyJson ( ) { PropertyName = dynPropState . PropertyName } ) ;
383+ var dummyProp = new DynamicPropertyJson ( ) { PropertyName = dynPropState . PropertyName } ;
384+
385+ // Preserve ControlPropertyState if it exists
386+ if ( dynPropState . ControlPropertyState != null )
387+ {
388+ dummyProp . ControlPropertyState = JsonSerializer . SerializeToElement ( dynPropState . ControlPropertyState ) ;
389+ }
390+
391+ dynamicProperties . Add ( dummyProp ) ;
384392 }
385393
386394 // Reorder to preserve roundtripping
@@ -659,7 +667,7 @@ private static DynamicPropertyJson GetDynamicPropertyEntry(ControlState state, s
659667 {
660668 property . Rule = new RuleEntry ( )
661669 {
662- InvariantScript = expression ,
670+ InvariantScript = expression ,
663671 RuleProviderType = "Unknown"
664672 } ;
665673 }
0 commit comments