From 95c48c77d9118a078b741d75096cc07e5b9cfc77 Mon Sep 17 00:00:00 2001 From: Chaim Date: Sun, 26 Apr 2026 11:08:29 +0000 Subject: [PATCH] fix(kb): prevent double-commit race + collapse admin sections by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two unrelated UX issues in the Knowledge Base manage tab: 1. Double-commit 400 error. The polling tick at index.js:1217 was blindly overwriting a locally-set 'committing' status with whatever the server reported. If the GET /batch poll raced ahead of the POST commitJob reaching the DB, the card flipped back to 'awaiting_review', the "אשר הכל" button re-enabled, and a second click triggered a duplicate commit which the backend rejected with HTTP 400 ("job N is in status 'done', expected 'awaiting_review'"). Fix: never downgrade 'committing' → 'awaiting_review' from the polling response. 2. Admin tab scrolling. The "מקורות בנושא", "תוויות תת-נושא" and "משימות אחרונות" panels were always expanded on tab entry, pushing the actual upload form far down the page. Wrapped each in a collapsible body with a chevron toggle, default collapsed. Data lazy-loads on first expand. Refs Task Master #21 Co-Authored-By: Claude Opus 4.6 (1M context) --- .taskmaster/tasks/tasks.json | 16 ++++++- .../knowledge-base/res/templates/kb/index.tpl | 45 ++++++++++++------ .../knowledge-base/src/views/kb/index.js | 46 ++++++++++++++++--- manifest.json | 4 +- 4 files changed, 85 insertions(+), 26 deletions(-) diff --git a/.taskmaster/tasks/tasks.json b/.taskmaster/tasks/tasks.json index c2b947c..b12302f 100644 --- a/.taskmaster/tasks/tasks.json +++ b/.taskmaster/tasks/tasks.json @@ -254,12 +254,24 @@ "priority": "medium", "subtasks": [], "updatedAt": "2026-04-25T20:19:47.523Z" + }, + { + "id": "21", + "title": "fix(kb): prevent double-commit + collapse admin sections", + "description": "Fix UI race in commitAllBatch + collapse Sources/Labels/Recent Jobs panels", + "details": "Fix 1: in polling tick (index.js ~1217), don't downgrade local 'committing' status back to 'awaiting_review' from server. Fix 2: wrap Sources, Labels and Recent Jobs panel bodies in collapsible div with chevron toggle, default collapsed; lazy-load on first expand.", + "testStrategy": "", + "status": "in-progress", + "dependencies": [], + "priority": "high", + "subtasks": [], + "updatedAt": "2026-04-26T11:01:34.264Z" } ], "metadata": { "version": "1.0.0", - "lastModified": "2026-04-25T20:19:47.523Z", - "taskCount": 20, + "lastModified": "2026-04-26T11:01:34.265Z", + "taskCount": 21, "completedCount": 14, "tags": [ "master" diff --git a/files/client/custom/modules/knowledge-base/res/templates/kb/index.tpl b/files/client/custom/modules/knowledge-base/res/templates/kb/index.tpl index 4f2f6a4..02d3be5 100644 --- a/files/client/custom/modules/knowledge-base/res/templates/kb/index.tpl +++ b/files/client/custom/modules/knowledge-base/res/templates/kb/index.tpl @@ -90,9 +90,12 @@ -
+
-

מקורות בנושא

+

+ + מקורות בנושא +