From ec475f4107a71104f312ec98126895c0f704995b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Wed, 4 Jan 2023 09:31:03 +0100 Subject: [PATCH] implement UmbLitElement --- .../collection-selection-actions.element.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection-selection-actions.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection-selection-actions.element.ts index cade122875..6bc267902e 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection-selection-actions.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection-selection-actions.element.ts @@ -1,13 +1,12 @@ import { UUITextStyles } from '@umbraco-ui/uui-css'; -import { css, html, LitElement, nothing } from 'lit'; +import { css, html, nothing } from 'lit'; import { customElement, property, state } from 'lit/decorators.js'; import type { UmbCollectionContext } from './collection.context'; -import { UmbContextConsumerMixin } from '@umbraco-cms/context-api'; import type { MediaDetails } from '@umbraco-cms/models'; -import { UmbObserverMixin } from '@umbraco-cms/observable-api'; +import { UmbLitElement } from 'src/core/element/lit-element.element'; @customElement('umb-collection-selection-actions') -export class UmbCollectionSelectionActionsElement extends UmbContextConsumerMixin(UmbObserverMixin(LitElement)) { +export class UmbCollectionSelectionActionsElement extends UmbLitElement { static styles = [ UUITextStyles, css` @@ -58,11 +57,11 @@ export class UmbCollectionSelectionActionsElement extends UmbContextConsumerMixi // TODO: Make sure it only updates on length change. this.observe>(this._collectionContext.data, (mediaItems) => { - this._nodesLength = mediaItems.length; + this._nodesLength = mediaItems?.length || 0; }); this.observe>(this._collectionContext.selection, (selection) => { - this._selectionLength = selection.length; + this._selectionLength = selection?.length || 0; }); }