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.
This commit is contained in:
yetone
2026-11-20 03:04:12 +08:00
parent 75d0b9feac
commit 03ae057b8e
@@ -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
}