From c4057bb010f2328561a56aa6df649071ca9b0301 Mon Sep 17 00:00:00 2001 From: Pier-Jean Malandrino Date: Tue, 14 Apr 2026 17:06:16 +0200 Subject: [PATCH] fix(e2e): update chunks synchronously in store to prevent rechunk timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ChunkPanel emitted 'rechunked' which triggered an async re-fetch via analysisStore.select() — but Vue does not await async emit handlers, so chunk-cards never appeared before the E2E 30s timeout. Now rechunk/edit/delete write returned chunks directly into the analysis store via updateChunks(), removing the async round-trip. --- frontend/src/features/analysis/store.ts | 10 ++++++++++ frontend/src/features/chunking/ui/ChunkPanel.vue | 15 ++++++++------- frontend/src/pages/StudioPage.vue | 7 ------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/frontend/src/features/analysis/store.ts b/frontend/src/features/analysis/store.ts index 06bb1b9..146c89b 100644 --- a/frontend/src/features/analysis/store.ts +++ b/frontend/src/features/analysis/store.ts @@ -111,6 +111,15 @@ export const useAnalysisStore = defineStore('analysis', () => { } } + function updateChunks(chunks: Chunk[]): void { + if (currentAnalysis.value) { + currentAnalysis.value = { + ...currentAnalysis.value, + chunksJson: JSON.stringify(chunks), + } + } + } + async function select(id: string): Promise { try { currentAnalysis.value = await api.fetchAnalysis(id) @@ -142,6 +151,7 @@ export const useAnalysisStore = defineStore('analysis', () => { load, run, select, + updateChunks, remove, stopPolling, } diff --git a/frontend/src/features/chunking/ui/ChunkPanel.vue b/frontend/src/features/chunking/ui/ChunkPanel.vue index a8328de..b55e2fb 100644 --- a/frontend/src/features/chunking/ui/ChunkPanel.vue +++ b/frontend/src/features/chunking/ui/ChunkPanel.vue @@ -225,6 +225,7 @@ diff --git a/frontend/src/pages/StudioPage.vue b/frontend/src/pages/StudioPage.vue index b314def..f98f85d 100644 --- a/frontend/src/pages/StudioPage.vue +++ b/frontend/src/pages/StudioPage.vue @@ -464,7 +464,6 @@ :has-document-json="analysisStore.currentAnalysis?.hasDocumentJson ?? false" :chunks="analysisStore.currentChunks" @highlight-bboxes="highlightedChunkBboxes = $event" - @rechunked="onRechunked" /> @@ -607,12 +606,6 @@ function addMore() { documentStore.selectedId = null } -async function onRechunked() { - if (analysisStore.currentAnalysis?.id) { - await analysisStore.select(analysisStore.currentAnalysis.id) - } -} - // Clear highlights when switching modes or pages watch(mode, () => { highlightedElementIndex.value = -1