From 61a18cdcb64931e85cffbfc6fe9360b93e3c560f Mon Sep 17 00:00:00 2001 From: Saxon Fletcher Date: Tue, 8 Apr 2025 21:30:35 +1000 Subject: [PATCH] set default value if empty array (#34828) --- .../ui/FileExplorerAndEditor/FileExplorerAndEditor.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/studio/components/ui/FileExplorerAndEditor/FileExplorerAndEditor.tsx b/apps/studio/components/ui/FileExplorerAndEditor/FileExplorerAndEditor.tsx index 073a2c74bf1..d9d6f233b54 100644 --- a/apps/studio/components/ui/FileExplorerAndEditor/FileExplorerAndEditor.tsx +++ b/apps/studio/components/ui/FileExplorerAndEditor/FileExplorerAndEditor.tsx @@ -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,