From 03ae057b8e23180de501aec246e8d222558c02f3 Mon Sep 17 00:00:00 2001 From: yetone Date: Fri, 20 Nov 2026 03:04:06 +0800 Subject: [PATCH] library: a native list that is not a list draws the tab without it 6d153bffc (#7244) iterates /api/library/native's reply. A reply that is not an array (a GUI test's catch-all {}, an older magpie behind a remote window) threw in nativeSection, and the Skills, MCP and Hooks tabs drew nothing. On origin/main 82611c3c9, skill-update-feedback, skill-where and library-open-again were 38 of 38 red on mica; about 111 GUI test files that touch the Library answer unknown /api paths with {}. A reply that is not an array now lists no native rows. A failed read still draws nothing, as before. Run (mica, via mica-run, at this head): skill-update-feedback and skill-where green in chromium and webkit (red at 82611c3c9). library-open-again stays red with its old error, "the library was read 1 times, not 2", the same as at f534245f1 before #7244 (#6975). go test -run Budget ./internal/gui ok. Not run: the whole GUI suite at this head. --- internal/gui/assets/plugins/library/client.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/gui/assets/plugins/library/client.js b/internal/gui/assets/plugins/library/client.js index 0d14abccd..e895e82b7 100644 --- a/internal/gui/assets/plugins/library/client.js +++ b/internal/gui/assets/plugins/library/client.js @@ -2215,7 +2215,10 @@ magpie.plugin("library", (ctx) => { if (nativeLoading) return; nativeLoading = true; try { - nativeView = await api("library/native"); + // a reply that is not a list (an older magpie, a stand-in) lists + // nothing; iterating it threw and left the whole tab undrawn + const r = await api("library/native"); + nativeView = Array.isArray(r) ? r : []; } catch { // a list that can't be read is not drawn, never a wrong one }