fix(app): guard session-header current() against undefined when options is empty#16478
Conversation
…ns 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
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
E2E Linux Failure AnalysisThe Failed test: Both failures reproduce identically on the This PR only modifies a single line in Re-running CI to confirm. |
216d497 to
99d5e6a
Compare
E2E Failure Confirmed Pre-existing (Not This PR)Re-ran CI twice. Both runs fail with identical tests:
These same tests fail on This PR's diff is a single-line change to the |
|
It may be worth comparing this to jon23d#1. I compiled it and ran the binary with: bun install I was able to start a session successfully after that. |
Issue for this PR
Closes #16459
Closes #16467
Type of change
What does this PR do?
session-header.tsxhas acurrentmemo that can returnundefined:options()is temporarily empty during two scenarios:platform.checkAppExistsresolves for each installed appWhen
options()is empty,options()[0]isundefined, socurrent()isundefined. The component then accessescurrent().id,current().label, andcurrent().iconwithout a null check, throwingTypeError: Cannot read properties of undefined (reading 'id')and crashing the entire UI with the "Something went wrong" screen.The fix adds a third fallback using
fileManager()(which is always defined) socurrent()is neverundefined:This is the same pattern as PR #16475 / #16476 which fix the structurally identical crash in
TextShimmer(issue #16473).How did you verify your code works?
Cannot read properties of undefined (reading 'id')in session bundle #16459 tosession-header.tsxline 306options()can be empty during startup and project switching by reading thecreateEffectthat populatesexistsasynchronously (lines 269–290)fileManager()return value, so all downstream.id,.label,.iconaccesses remain validScreenshots / recordings
No visual change — this only prevents a crash, the UI behavior when
options()is non-empty is identical.Checklist