Skip to content

Commit d9de35d

Browse files
fix(files): scope mothership preview-toggle loading guard to CSV files only
1 parent 56f941c commit d9de35d

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/mothership-view.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,16 @@ export const MothershipView = memo(
9292
enabled: active?.type === 'file',
9393
})
9494
const activeFile = active?.type === 'file' ? files?.find((f) => f.id === active.id) : undefined
95+
const isActiveCsv = active?.type === 'file' && getFileExtension(active.title) === 'csv'
9596

9697
const isActivePreviewable =
9798
canEdit &&
9899
active?.type === 'file' &&
99100
RICH_PREVIEWABLE_EXTENSIONS.has(getFileExtension(active.title)) &&
100-
// Wait for the record before deciding — otherwise the toggle flashes on for a large CSV
101-
// until its size loads and we can tell it's read-only.
102-
!filesLoading &&
101+
// Only a CSV's previewability depends on its size (large = read-only, no editor). Wait for
102+
// the record before deciding so the toggle doesn't flash on for a large CSV — but don't gate
103+
// other rich types (markdown, html, svg, …) on the file list loading.
104+
!(isActiveCsv && filesLoading) &&
103105
!(activeFile && isCsvStreamOnly(activeFile))
104106

105107
return (

0 commit comments

Comments
 (0)