From 14c0b5054ff195a13d121281e3b2356c9b77e6bc Mon Sep 17 00:00:00 2001 From: Theodore Li Date: Fri, 3 Jul 2026 13:23:03 -0700 Subject: [PATCH 1/6] fix(ui): surface silent validation and rejection errors across editors and modals --- .../components/chunk-editor/chunk-editor.tsx | 20 +++++- .../settings/components/general/general.tsx | 3 + .../cells/expanded-cell-popover.tsx | 24 +++++-- .../table-grid/cells/inline-editors.tsx | 64 +++++++++++++++---- .../deploy-modal/components/chat/chat.tsx | 21 ++++-- .../components/version-description-modal.tsx | 9 ++- .../create-workspace-modal.tsx | 26 ++++++-- .../sidebar/hooks/use-workspace-management.ts | 1 + 8 files changed, 133 insertions(+), 35 deletions(-) diff --git a/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/components/chunk-editor/chunk-editor.tsx b/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/components/chunk-editor/chunk-editor.tsx index bdab7e2a328..07713262174 100644 --- a/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/components/chunk-editor/chunk-editor.tsx +++ b/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/components/chunk-editor/chunk-editor.tsx @@ -59,6 +59,7 @@ export function ChunkEditor({ const [editedContent, setEditedContent] = useState(isCreateMode ? '' : chunkContent) const [savedContent, setSavedContent] = useState(chunkContent) + const [validationError, setValidationError] = useState(null) const [tokenizerOn, setTokenizerOn] = useState(false) const [hoveredTokenIndex, setHoveredTokenIndex] = useState(null) const savedContentRef = useRef(chunkContent) @@ -108,8 +109,15 @@ export function ChunkEditor({ const handleSave = useCallback(async () => { const content = editedContentRef.current const trimmed = content.trim() - if (trimmed.length === 0) throw new Error('Content cannot be empty') - if (trimmed.length > 10000) throw new Error('Content exceeds maximum length') + if (trimmed.length === 0) { + setValidationError('Content cannot be empty') + throw new Error('Content cannot be empty') + } + if (trimmed.length > 10000) { + setValidationError('Content exceeds maximum length (10,000 characters)') + throw new Error('Content exceeds maximum length') + } + setValidationError(null) if (isCreateMode) { const created = await createChunk({ @@ -234,7 +242,10 @@ export function ChunkEditor({