@decky/ui 4.1.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,10 +3,10 @@ import { Field, Focusable, GamepadButton } from '../components';
3
3
  export function ReorderableList(props) {
4
4
  if (props.animate === undefined)
5
5
  props.animate = true;
6
- const [entryList, setEntryList] = useState(props.entries.sort((a, b) => a.position - b.position));
6
+ const [entryList, setEntryList] = useState([...props.entries].sort((a, b) => a.position - b.position));
7
7
  const [reorderEnabled, setReorderEnabled] = useState(false);
8
8
  useEffect(() => {
9
- setEntryList(props.entries.sort((a, b) => a.position - b.position));
9
+ setEntryList([...props.entries].sort((a, b) => a.position - b.position));
10
10
  }, [props.entries]);
11
11
  function toggleReorderEnabled() {
12
12
  let newReorderValue = !reorderEnabled;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decky/ui",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "description": "A library for interacting with the Steam frontend in Decky plugins and elsewhere.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -35,12 +35,12 @@ export type ReorderableListProps<T> = {
35
35
  export function ReorderableList<T>(props: ReorderableListProps<T>) {
36
36
  if (props.animate === undefined) props.animate = true;
37
37
  const [entryList, setEntryList] = useState<ReorderableEntry<T>[]>(
38
- props.entries.sort((a: ReorderableEntry<T>, b: ReorderableEntry<T>) => a.position - b.position),
38
+ [...props.entries].sort((a: ReorderableEntry<T>, b: ReorderableEntry<T>) => a.position - b.position),
39
39
  );
40
40
  const [reorderEnabled, setReorderEnabled] = useState<boolean>(false);
41
41
 
42
42
  useEffect(() => {
43
- setEntryList(props.entries.sort((a: ReorderableEntry<T>, b: ReorderableEntry<T>) => a.position - b.position));
43
+ setEntryList([...props.entries].sort((a: ReorderableEntry<T>, b: ReorderableEntry<T>) => a.position - b.position));
44
44
  }, [props.entries]);
45
45
 
46
46
  function toggleReorderEnabled(): void {