Skip to content

fix(telos): crash guards for one-mission users in Life Dashboard#1154

Open
brycemagera wants to merge 1 commit intodanielmiessler:mainfrom
brycemagera:fix/pulse-telos-dashboard
Open

fix(telos): crash guards for one-mission users in Life Dashboard#1154
brycemagera wants to merge 1 commit intodanielmiessler:mainfrom
brycemagera:fix/pulse-telos-dashboard

Conversation

@brycemagera
Copy link
Copy Markdown

@brycemagera brycemagera commented May 3, 2026

Problem

Any user with fewer than 2 missions defined gets an immediate TypeError on the Telos page:

TypeError: Cannot read properties of undefined (reading 'horizon')

Three spots used missions[1] as a fallback:

  • sections.tsx line 89 — fallback mission for rendering
  • horizon.tsx line 15 — same
  • app.tsx — initial mission state hardcoded to "M1"; when live data loads with only M0, no valid mission is selected

Fix

sections.tsx + horizon.tsx: missions[1]missions[0] + explicit null guard so the component can return null cleanly if no missions exist at all.

app.tsx: initial state "M1""M0"; added useEffect to reset to the first available mission ID when live data arrives with different IDs than the initial state assumed.

How This Fits With the Other Telos PRs

Three open PRs each fix a different layer of the telos stack — all complementary, no conflicts:

PR Layer Files
#1127 (jmmarkiewicz) CLI summary generator GenerateTelosSummary.ts — regex, strategy bullets, goal section classifier
#1147 (Alessandro-Improta) Live data pipeline observability.ts parser robustness + use-telos-data.ts fetch wired to /api/telos/overview
#1154 (this PR) Crash prevention sections.tsx, horizon.tsx, app.tsx — guards for < 2 missions

Recommended merge order: #1127 (standalone) → #1147 (data plumbing) → #1154 (crash guards surface once data flows).

Revision Note

Originally this PR also introduced a new /telos endpoint in pulse.ts + modules/telos.ts. After reviewing #1147, that approach was dropped — #1147's use of the existing /api/telos/overview endpoint is architecturally correct and avoids a parallel endpoint. This PR is now focused exclusively on crash prevention.

sections.tsx: missions[1] fallback → missions[0] + explicit null guard
horizon.tsx:  missions[1] fallback → missions[0]
app.tsx:      initial mission state "M1" → "M0"; useEffect to reset to
              first available id when live data loads

Complements danielmiessler#1147 (data plumbing). Crash affects any user with < 2
missions: TypeError: Cannot read properties of undefined (reading 'horizon').
@brycemagera brycemagera force-pushed the fix/pulse-telos-dashboard branch from 3f328db to 76d0ac5 Compare May 3, 2026 15:24
@brycemagera brycemagera changed the title fix(pulse): live telos data for Life Dashboard + crash guards fix(telos): crash guards for one-mission users in Life Dashboard May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant