mirror of
https://github.com/outline/outline.git
synced 2026-11-28 00:09:58 +03:00
fix: Cannot sort observable array
This commit is contained in:
1 file changed
+4
-3
@@ -40,9 +40,10 @@ function naturalSortBy<T extends object>(
|
||||
})
|
||||
: sorter;
|
||||
|
||||
return items.sort((a: T, b: T) =>
|
||||
sort(getSortByField(a, key), getSortByField(b, key))
|
||||
);
|
||||
// Sort a copy, `items` may be an observable array which cannot be sorted in place.
|
||||
return items
|
||||
.slice()
|
||||
.sort((a: T, b: T) => sort(getSortByField(a, key), getSortByField(b, key)));
|
||||
}
|
||||
|
||||
export default naturalSortBy;
|
||||
Reference in new issue
Block a user