stylesheet update condition

# Conflicts:
#	src/packages/block/block-grid/components/block-grid-entries/block-grid-entries.element.ts

# Conflicts:
#	src/packages/block/block-grid/components/block-grid-areas-container/block-grid-areas-container.element.ts
#	src/packages/block/block-grid/components/block-grid-entries/block-grid-entries.element.ts
This commit is contained in:
Niels Lyngsø
2024-07-03 09:17:58 +02:00
parent f301af32d0
commit 48fbe7af77
2 changed files with 6 additions and 7 deletions

View File

@@ -46,10 +46,10 @@ export class UmbBlockGridAreasContainerElement extends UmbLitElement {
manager.layoutStylesheet,
(stylesheet) => {
// Do not re-render stylesheet if its the same href.
if (!stylesheet || this._styleElement?.getAttribute('href') === stylesheet) return;
if (!stylesheet || this._styleElement?.href === stylesheet) return;
this._styleElement = document.createElement('link');
this._styleElement.setAttribute('rel', 'stylesheet');
this._styleElement.setAttribute('href', stylesheet);
this._styleElement.rel = 'stylesheet';
this._styleElement.href = stylesheet;
},
'observeStylesheet',
);

View File

@@ -209,11 +209,10 @@ export class UmbBlockGridEntriesElement extends UmbFormControlMixin(UmbLitElemen
this.observe(
manager.layoutStylesheet,
(stylesheet) => {
if (!stylesheet) return;
if (this._styleElement?.href === stylesheet) return;
if (!stylesheet || this._styleElement?.href === stylesheet) return;
this._styleElement = document.createElement('link');
this._styleElement.setAttribute('rel', 'stylesheet');
this._styleElement.setAttribute('href', stylesheet);
this._styleElement.rel = 'stylesheet';
this._styleElement.href = stylesheet;
},
'observeStylesheet',
);