fix(kb): prevent double-commit race + collapse admin sections by default

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) <noreply@anthropic.com>
This commit is contained in:
2026-04-26 11:08:29 +00:00
parent 1b8972c264
commit 95c48c77d9
4 changed files with 85 additions and 26 deletions
+14 -2
View File
@@ -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"