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,