Skip to content

Commit 3266185

Browse files
committed
fix(interfaces): unbreak the build and guard the chat attachment read
- data-table.tsx kept a './document-table.css' import after being moved into its own directory; the CSS sits one level up, where both siblings correctly reference it as '../'. tsc does not resolve CSS imports and vitest stubs them, so this only surfaced in a real Next build — CI was red. Swept every relative asset import repo-wide; this was the only broken one. - The chat module read attachments outside its try. toChatFilePayloads rejects when FileReader errors (a file deleted or moved between selection and send), and by that point the turn is committed: runningRef is set and a streaming bubble is on screen. An escaping rejection left the bubble spinning and the guard stuck true, so every later send returned early and the module stayed dead until remount. The existing finally already tears this down correctly; the read just needed to be inside it.
1 parent b1b96d3 commit 3266185

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

apps/sim/components/resources/file-view/components/data-table/data-table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { forwardRef, memo, useCallback, useImperativeHandle, useRef, useState } from 'react'
44
import { cn } from '@sim/emcn'
5-
import './document-table.css'
5+
import '../document-table.css'
66

77
interface EditConfig {
88
onCellChange: (row: number, col: number, value: string) => void

apps/sim/components/resources/interface-view/components/module-renderer/components/chat-module/hooks/use-interface-chat.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,21 @@ export function useInterfaceChat({
359359
settle(succeeded ? NO_OUTPUT_NOTE : CHAT_ERROR_MESSAGES.GENERIC_ERROR)
360360
}
361361

362-
/**
363-
* Read here rather than in the composer: only images arrive pre-read, so
364-
* every other attachment is turned into its base64 payload at send time.
365-
*/
366-
const filePayloads = await toChatFilePayloads(files)
367-
368362
try {
363+
/**
364+
* Read here rather than in the composer: only images arrive pre-read, so
365+
* every other attachment is turned into its base64 payload at send time.
366+
*
367+
* Inside the `try` because `FileReader` rejects on an unreadable file —
368+
* a real case, since a file can be deleted or moved between selection
369+
* and send. By this point the turn is already committed: `runningRef` is
370+
* set and a streaming bubble is on screen. Escaping here would leave the
371+
* bubble spinning forever and `runningRef` stuck true, so every later
372+
* send would return early and the module would be dead until remount.
373+
* The `finally` below is the only thing that clears that state.
374+
*/
375+
const filePayloads = await toChatFilePayloads(files)
376+
369377
await execute({
370378
workflowId: runId,
371379
endpoint: activeEndpoint,

0 commit comments

Comments
 (0)