From a24652f9018b1a8ef8aa763fd029ca810c6fbc69 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Mon, 28 Jul 2025 19:35:41 +0530 Subject: [PATCH] (feat:chunks) update iff changed --- frontend/src/components/DocumentChunks.tsx | 49 ++++++++++++++++++---- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/DocumentChunks.tsx b/frontend/src/components/DocumentChunks.tsx index b56e1514..f29941d2 100644 --- a/frontend/src/components/DocumentChunks.tsx +++ b/frontend/src/components/DocumentChunks.tsx @@ -154,6 +154,10 @@ const DocumentChunks: React.FC = ({ }; const handleAddChunk = (title: string, text: string) => { + if (!text.trim()) { + return; + } + try { const metadata = { source: path || documentName, @@ -182,6 +186,18 @@ const DocumentChunks: React.FC = ({ }; const handleUpdateChunk = (title: string, text: string, chunk: ChunkType) => { + + if (!text.trim()) { + return; + } + + const originalTitle = chunk.metadata?.title || ''; + const originalText = chunk.text || ''; + + if (title === originalTitle && text === originalText) { + return; + } + try { userService .updateChunk( @@ -326,11 +342,23 @@ const DocumentChunks: React.FC = ({ @@ -349,10 +377,17 @@ const DocumentChunks: React.FC = ({