Merge pull request #2067 from umbraco/v14/bugfix/fix-array-state-sorting
Fix: array state sorting
This commit is contained in:
@@ -35,7 +35,10 @@ export class UmbArrayState<T> extends UmbDeepState<T[]> {
|
||||
*/
|
||||
sortBy(sortMethod?: (a: T, b: T) => number) {
|
||||
this.#sortMethod = sortMethod;
|
||||
super.setValue(this.getValue().sort(this.#sortMethod));
|
||||
const value = this.getValue();
|
||||
if(value) {
|
||||
super.setValue([...value].sort(this.#sortMethod));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -51,7 +54,7 @@ export class UmbArrayState<T> extends UmbDeepState<T[]> {
|
||||
*/
|
||||
override setValue(value: T[]) {
|
||||
if (this.#sortMethod) {
|
||||
super.setValue(value.sort(this.#sortMethod));
|
||||
super.setValue([...value].sort(this.#sortMethod));
|
||||
} else {
|
||||
super.setValue(value);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { manifest as blockListSchemaManifest } from './Umbraco.BlockList.js';
|
||||
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { manifest as blockListSchemaManifest } from './Umbraco.BlockList.js';
|
||||
|
||||
export const UMB_BLOCK_LIST_PROPERTY_EDITOR_ALIAS = 'Umbraco.BlockList';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user