Skip to content

Commit 712077e

Browse files
authored
Merge pull request storybookjs#31578 from storybookjs/kasper/fix-read-only-arrays
Core: Make sure to only mutate writable arrays
2 parents fd3356c + 62facc5 commit 712077e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

code/core/src/test/preview.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ export const traverseArgs = (value: unknown, depth = 0, key?: string): unknown =
5959
// we loop instead of map to prevent this lit issue:
6060
// https://github.com/storybookjs/storybook/issues/25651
6161
for (let i = 0; i < value.length; i++) {
62-
value[i] = traverseArgs(value[i], depth);
62+
if (Object.getOwnPropertyDescriptor(value, i)?.writable) {
63+
value[i] = traverseArgs(value[i], depth);
64+
}
6365
}
6466
return value;
6567
}

0 commit comments

Comments
 (0)