prevent to much ui updating

This commit is contained in:
Mads Rasmussen
2024-04-18 14:35:38 +02:00
parent 2f107d2612
commit e984e23b49

View File

@@ -49,9 +49,12 @@ export class UmbUserCollectionHeaderElement extends UmbLitElement {
this.observe(
observeMultiple([this.#collectionContext.orderByOptions, this.#collectionContext.activeOrderByOption]),
([options, activeOption]) => {
this._orderByOptions = options;
// the options are hardcoded in the context, so we can just compare the length
if (this._orderByOptions.length !== options.length) {
this._orderByOptions = options;
}
if (activeOption) {
if (activeOption && activeOption !== this._activeOrderByOption?.unique) {
this._activeOrderByOption = this._orderByOptions.find((option) => option.unique === activeOption);
}
},