Skip to content

Commit 0c2d4e2

Browse files
authored
Merge pull request #2067 from umbraco/v14/bugfix/fix-array-state-sorting
Fix: array state sorting
2 parents 9bc24ee + 59169de commit 0c2d4e2

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/libs/observable-api/states/array-state.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ export class UmbArrayState<T> extends UmbDeepState<T[]> {
3535
*/
3636
sortBy(sortMethod?: (a: T, b: T) => number) {
3737
this.#sortMethod = sortMethod;
38-
super.setValue(this.getValue().sort(this.#sortMethod));
38+
const value = this.getValue();
39+
if(value) {
40+
super.setValue([...value].sort(this.#sortMethod));
41+
}
3942
return this;
4043
}
4144

@@ -51,7 +54,7 @@ export class UmbArrayState<T> extends UmbDeepState<T[]> {
5154
*/
5255
override setValue(value: T[]) {
5356
if (this.#sortMethod) {
54-
super.setValue(value.sort(this.#sortMethod));
57+
super.setValue([...value].sort(this.#sortMethod));
5558
} else {
5659
super.setValue(value);
5760
}

src/packages/block/block-list/property-editors/block-list-editor/manifests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { manifest as blockListSchemaManifest } from './Umbraco.BlockList.js';
21
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
2+
import { manifest as blockListSchemaManifest } from './Umbraco.BlockList.js';
33

44
export const UMB_BLOCK_LIST_PROPERTY_EDITOR_ALIAS = 'Umbraco.BlockList';
55

0 commit comments

Comments
 (0)