Skip to content

Commit 99d5e6a

Browse files
committed
fix(app): guard session-header current() against undefined when options is empty
When options() is temporarily empty (during startup or project switching), options()[0] returns undefined, causing current().id to throw a TypeError. Add a fileManager()-based fallback so current() always returns a valid object. Fixes anomalyco#16459 Fixes anomalyco#16467
1 parent 641e178 commit 99d5e6a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎packages/app/src/components/session/session-header.tsx‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,12 @@ export function SessionHeader() {
303303
})
304304

305305
const canOpen = createMemo(() => platform.platform === "desktop" && !!platform.openPath && server.isLocal())
306-
const current = createMemo(() => options().find((o) => o.id === prefs.app) ?? options()[0])
306+
const current = createMemo(
307+
() =>
308+
options().find((o) => o.id === prefs.app) ??
309+
options()[0] ??
310+
({ id: "finder", label: fileManager().label, icon: fileManager().icon } as const),
311+
)
307312
const opening = createMemo(() => openRequest.app !== undefined)
308313

309314
const selectApp = (app: OpenApp) => {

0 commit comments

Comments
 (0)