@@ -904,14 +904,17 @@ export function styleControl<T extends readonly SingleColorConfig[]>(
904904 const appTheme = isPreviewTheme || isDefaultTheme || ( ! preventStyleOverwriting && ! preventAppStylesOverwriting )
905905 ? theme ?. theme
906906 : defaultTheme ;
907- const compTheme = isPreviewTheme || isDefaultTheme || ( compType && ! preventStyleOverwriting && ! preventAppStylesOverwriting )
908- ? {
909- ...( omit ( defaultTheme , 'components' , 'chart' ) ) ,
910- ...defaultTheme . components ?. [ compType ] ?. [ styleKey ] as unknown as Record < string , string > ,
911- ...( omit ( theme ?. theme , 'components' , 'chart' ) ) ,
912- ...theme ?. theme ?. components ?. [ compType ] ?. [ styleKey ] as unknown as Record < string , string > ,
913- }
914- : defaultTheme . components ?. [ compType ] ?. [ styleKey ] ;
907+ let compTheme : JSONValue | undefined = { } ;
908+ if ( appliedThemeId !== themeId ) {
909+ compTheme = isPreviewTheme || isDefaultTheme || ( compType && ! preventStyleOverwriting && ! preventAppStylesOverwriting )
910+ ? {
911+ ...( omit ( defaultTheme , 'components' , 'chart' ) ) ,
912+ ...defaultTheme . components ?. [ compType ] ?. [ styleKey ] as unknown as Record < string , string > ,
913+ ...( omit ( theme ?. theme , 'components' , 'chart' ) ) ,
914+ ...theme ?. theme ?. components ?. [ compType ] ?. [ styleKey ] as unknown as Record < string , string > ,
915+ }
916+ : defaultTheme . components ?. [ compType ] ?. [ styleKey ] ;
917+ }
915918 const styleProps = ( ! comp && ! compType ) || preventStyleOverwriting || preventAppStylesOverwriting || appliedThemeId === themeId
916919 ? props as ColorMap
917920 : { } as ColorMap ;
0 commit comments