[CYS] Improve logic to ensure that the font is active (#45385)

* improve logic to ensure that the font is active

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Luigi Teschio 2024-03-07 19:44:01 +01:00 committed by GitHub
parent 60d93e447f
commit 76e7d84523
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View File

@ -115,9 +115,13 @@ export const VariationContainer = ( { variation, children } ) => {
// With the Font Library, the fontFamilies object contains an array of font families installed with the Font Library under the key 'custom'.
// We need to compare only the active theme font families, so we compare the theme font families with the current variation.
const { theme } = user.settings.typography.fontFamilies;
return variation.settings.typography?.fontFamilies.theme.every(
( { slug } ) =>
theme.some( ( { slug: themeSlug } ) => themeSlug === slug )
return (
variation.settings.typography?.fontFamilies.theme.every(
( { slug } ) =>
theme.some( ( { slug: themeSlug } ) => themeSlug === slug )
) &&
theme.length ===
variation.settings.typography?.fontFamilies.theme.length
);
}, [ user, variation ] );

View File

@ -0,0 +1,4 @@
Significance: minor
Type: fix
[CYS] Improve logic to ensure that the font is active.