set default value if empty array (#34828)

This commit is contained in:
Saxon Fletcher
2025-04-08 21:30:35 +10:00
committed by GitHub
parent ec7e80bbef
commit 61a18cdcb6

View File

@@ -82,7 +82,7 @@ const FileExplorerAndEditor = ({
}
const addNewFile = () => {
const newId = Math.max(...files.map((f) => f.id)) + 1
const newId = Math.max(0, ...files.map((f) => f.id)) + 1
const updatedFiles = files.map((f) => ({ ...f, selected: false }))
onFilesChange([
...updatedFiles,