From e524567a7bfe850dfd2408249dcc3eaaaa8e3593 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Mon, 11 Mar 2024 17:56:46 +0100 Subject: [PATCH] fix(material/core): theming validation for m2 themes firing incorrectly (#28707) Fixes that theming validation for M2 themes was firing incorrectly, because the validation code was going through the `get-color-config`, `get-density-config` and `get-typography-config` functions which in turn were reading the internalized version of the theme where all the values were the same. Since Sass maps are immutable, they were being compared based on their values and always considered as the same theme. --- src/material/core/theming/_theming.scss | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/material/core/theming/_theming.scss b/src/material/core/theming/_theming.scss index 5a012bb79fb1..186366221b96 100644 --- a/src/material/core/theming/_theming.scss +++ b/src/material/core/theming/_theming.scss @@ -432,9 +432,10 @@ $_internals: _mat-theming-internals-do-not-access; // Checks for duplicate styles in a `theme-version: 0` style theme. @mixin _check-duplicate-theme-styles-v0($theme-or-color-config, $id) { $theme: private-legacy-get-theme($theme-or-color-config); - $color-config: get-color-config($theme); - $density-config: get-density-config($theme); - $typography-config: get-typography-config($theme); + $color-config: map.get($theme, $_internals, m2-config, color) or get-color-config($theme); + $density-config: map.get($theme, $_internals, m2-config, density) or get-density-config($theme); + $typography-config: + map.get($theme, $_internals, m2-config, typography) or get-typography-config($theme); // Lists of previous `color`, `density` and `typography` configurations. $previous-color: map.get($_emitted-color, $id) or (); $previous-typography: map.get($_emitted-typography, $id) or ();