Files
Enterprise-Knowledge-Base/frontend
Martín Alcalá Rubí bbf7ac29bf fix(frontend): dedupe KB list to stop empty render with ≥2 knowledge bases
The "All" scope of the knowledge-base list renders every card with
`:key="kb.id"`. The same knowledge base can appear more than once in the
source data — owned *and* shared back to the caller, or shared into their
view through two different organizations (distinct share_id, identical
knowledge_base.id). Duplicate `v-for` keys corrupt Vue's virtual-DOM
patch and the list renders empty/partial. A single KB never collides, so
the page works with one KB and blanks once there are two or more — the
exact behavior reported in #795.

Extract the merge into a pure, unit-tested helper
(mergeAllScopeKnowledgeBases) that de-duplicates by knowledge-base id —
owned rows win over shared duplicates, and repeated shares of one KB keep
the most-privileged permission — while preserving the existing
pinned → mine → teammate → shared(editable-first) ordering.

Tests use the repo's existing node:test convention; a `test` script is
added so `npm test` discovers them (it also wires up the two previously
orphaned *.test.ts files).

Fixes #795

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 12:10:30 +08:00
..
2025-08-05 15:08:07 +08:00
2026-05-21 16:56:19 +08:00
2025-08-05 15:08:07 +08:00
2025-08-05 15:08:07 +08:00
2025-08-05 15:08:07 +08:00