Skip to content

Commit 00d513e

Browse files
author
Theodore Li
committed
Fix new file logic to default to text
1 parent 934f8f6 commit 00d513e

File tree

1 file changed

+3
-2
lines changed
  • apps/sim/app/workspace/[workspaceId]/files

1 file changed

+3
-2
lines changed

apps/sim/app/workspace/[workspaceId]/files/files.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,11 @@ export function Files() {
476476
}, [closeListContextMenu])
477477

478478
useEffect(() => {
479-
if (justCreatedFileIdRef.current && selectedFileId !== justCreatedFileIdRef.current) {
479+
const isJustCreated = selectedFileId != null && justCreatedFileIdRef.current === selectedFileId
480+
if (justCreatedFileIdRef.current && !isJustCreated) {
480481
justCreatedFileIdRef.current = null
481482
}
482-
setShowPreview(true)
483+
setShowPreview(!isJustCreated)
483484
}, [selectedFileId])
484485

485486
useEffect(() => {

0 commit comments

Comments
 (0)