Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 4c4c170

Browse files
devversionThomasBurleson
authored andcommitted
fix(theming): only insert default theme if its usable.
* Currently we always generate the default theme, even when the defaultTheme has changed. This is not necessary and impacts the performance significant. We should only inject the default theme, when it's usable. Fixes #7425. Closes #8578
1 parent 2fa2e4d commit 4c4c170

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/services/theming/theming.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ function parseRules(theme, colorType, rules) {
526526
var rulesByType = {};
527527

528528
// Generate our themes at run time given the state of THEMES and PALETTES
529-
function generateAllThemes($injector, $mdTheming ) {
529+
function generateAllThemes($injector, $mdTheming) {
530530
var head = document.head;
531531
var firstChild = head ? head.firstElementChild : null;
532532
var themeCss = !disableTheming && $injector.has('$MD_THEME_CSS') ? $injector.get('$MD_THEME_CSS') : '';
@@ -581,7 +581,7 @@ function generateAllThemes($injector, $mdTheming ) {
581581
if (generateOnDemand) return;
582582

583583
angular.forEach($mdTheming.THEMES, function(theme) {
584-
if (!GENERATED[theme.name]) {
584+
if (!GENERATED[theme.name] && !($mdTheming.defaultTheme() !== 'default' && theme.name === 'default')) {
585585
generateTheme(theme, theme.name, nonce);
586586
}
587587
});

0 commit comments

Comments
 (0)