fix(ui): zone writes during startup no longer erase persisted Workboard pins (#123475)

The reconciler dropped workboard entries from the canonical persisted list
whenever workboardEnabled was false — but enablement reads as disabled until
the runtime config snapshot loads, so any pin/unpin/drag in that window
permanently deleted every workboard pin from synced prefs. The boards-not-
ready branch already preserved slots for exactly this ambiguity; disabled
now folds into it. Prod net −1.
This commit is contained in:
Peter Steinberger
2026-08-14 00:19:31 -07:00
committed by GitHub
parent e51ee089b7
commit 00dbf6fd85
2 changed files with 13 additions and 9 deletions
+8 -3
View File
@@ -64,7 +64,7 @@ describe("reconcileSidebarZone", () => {
).toEqual(["route:usage"]);
});
it("keeps active Workboard boards and drops stale or plugin-off pins", () => {
it("keeps active Workboard boards, drops stale ids, and preserves plugin-off pins", () => {
const boards = [
{ id: "default", total: 0, active: 0, archived: 0, byStatus: {} },
{ id: "ops", total: 0, active: 0, archived: 0, byStatus: {} },
@@ -80,6 +80,8 @@ describe("reconcileSidebarZone", () => {
true,
).sidebarEntries,
).toEqual(["workboard:ops", "route:usage"]);
// Disabled is indistinguishable from an unloaded config snapshot at
// startup; a zone write then must not erase persisted pins.
expect(
reconcileSidebarZone(
["workboard:ops", "route:usage"],
@@ -89,8 +91,11 @@ describe("reconcileSidebarZone", () => {
boards,
false,
true,
).sidebarEntries,
).toEqual(["route:usage"]);
),
).toEqual({
entries: [{ type: "route", route: "usage" }],
sidebarEntries: ["workboard:ops", "route:usage"],
});
});
it("preserves Workboard pins until the active plugin's board catalog is authoritative", () => {
+5 -6
View File
@@ -51,14 +51,13 @@ export function reconcileSidebarZone(
continue;
}
if (entry.type === "workboard") {
if (!workboardEnabled) {
continue;
}
seen.add(canonicalKey);
canonical.push(canonicalKey);
// An unloaded catalog cannot distinguish deletion from startup. Preserve
// the slot but render nothing until the active plugin returns its ids.
if (!workboardBoardsReady) {
// Disabled reads exactly like startup: the runtime config snapshot is
// unloaded until the gateway answers, so a zone write in that window
// would erase every persisted pin. Preserve the slot, render nothing;
// only a loaded catalog that positively lacks the id deletes below.
if (!workboardEnabled || !workboardBoardsReady) {
continue;
}
if (!validBoardIds.has(entry.boardId)) {