From 0d5fcbc3df980fb3dd094b4cb3065b23e34548e5 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Wed, 10 Aug 2022 15:10:38 +0400 Subject: [PATCH] Site Editor: Fix error in compileStyleValue (#43116) * Site Editor: Fix error in compileStyleValue * Use shorter alternative Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com> --- .../src/components/global-styles/use-global-styles-output.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/edit-site/src/components/global-styles/use-global-styles-output.js b/packages/edit-site/src/components/global-styles/use-global-styles-output.js index 2e27d0a4453459..1736df73235eb7 100644 --- a/packages/edit-site/src/components/global-styles/use-global-styles-output.js +++ b/packages/edit-site/src/components/global-styles/use-global-styles-output.js @@ -49,7 +49,8 @@ function compileStyleValue( uncompiledValue ) { const VARIABLE_REFERENCE_PREFIX = 'var:'; const VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|'; const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--'; - if ( uncompiledValue?.startsWith( VARIABLE_REFERENCE_PREFIX ) ) { + + if ( uncompiledValue?.startsWith?.( VARIABLE_REFERENCE_PREFIX ) ) { const variable = uncompiledValue .slice( VARIABLE_REFERENCE_PREFIX.length ) .split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )