fix(app): don't crash settings when the server returns a non-array config

This commit is contained in:
Brendonovich
2026-10-31 16:51:58 +00:00
Unverified
parent 3960ebb5b9
commit 489b57dbb8
@@ -33,9 +33,17 @@ export function createServerShellController(server: Accessor<ServerConnection.An
async () => {
const context = serverCtx()
// The client does not validate response shapes, so an incompatible server can return a
// non-array 200 body; treat it like a failed request instead of crashing the page.
const [entries, shells] = await Promise.all([
context.sdk.api.config.get().catch(() => []),
context.sdk.api.config.shells().catch(() => []),
context.sdk.api.config
.get()
.then((value) => (Array.isArray(value) ? value : []))
.catch(() => []),
context.sdk.api.config
.shells()
.then((value) => (Array.isArray(value) ? value : []))
.catch(() => []),
])
const boundary = entries.findIndex((entry) => entry.type === "directory")