Skip to content

Commit

Permalink
fix(material/core): theming validation for m2 themes firing incorrect…
Browse files Browse the repository at this point in the history
…ly (#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.

(cherry picked from commit e524567)
  • Loading branch information
crisbeto committed Mar 11, 2024
1 parent 0b6f153 commit 36d82d8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/material/core/theming/_theming.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
Expand Down

0 comments on commit 36d82d8

Please sign in to comment.