fix: guard trend access against eager JSX evaluation (closes #5, #6) - #7
Merged
Conversation
npm-installed plugins live under node_modules, which opencode/opentui exclude from the babel-preset-solid transform (opencode#39986). Bun then compiles the raw TSX with its generic JSX (jsxDEV), eagerly evaluating <Show>/<For> children before guards run. With no session data yet, hasTrend is false and trend is undefined, so props.trend!.color threw TypeError and the per-slot ErrorBoundary silently unmounted the sidebar panel (#5, #6). - TuiHitRow: props.trend!.color -> props.trend?.color (safe under both eager and lazy evaluation) - Hardening: cache-ttl-view elapsed()!, main-session-view messages! -> optional props with runtime guards - tests/eager-render.test.ts: renders TuiHitRow with trend=undefined under bun's eager load path (verified to fail on the pre-fix !) - tests/eager-safe-jsx.test.ts: scans src tsx for guard-variable ! derefs and optional-chain-then-bare-deref patterns - AGENTS.md: Eager-safe JSX convention - devDep @opentui/solid 0.3.0 -> 0.4.5; version 0.6.3 -> 0.6.4
This was referenced Aug 7, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the silent sidebar unmount reported in #5 and #6.
Root cause: npm-installed plugins live under
node_modules, which opencode/opentui exclude from the babel-preset-solid transform (see opencode#39986 — the transform filter has a hardcodednode_modulesexclusion since OpenTUI 0.4.2). Bun then compiles the raw TSX with its generic JSX (jsxDEV), which eagerly evaluates<Show>/<For>children before thewhen/guard runs. With no session data yet (fresh start / pre-sync),hasTrendis false →trendisundefined→props.trend!.colorthrowsTypeError→ the per-slot<ErrorBoundary>silently unmounts the panel with no error surfaced (#5, #6).Changes
TuiHitRow:props.trend!.color→props.trend?.color— safe under both eager (bun generic JSX) and lazy (babel-preset-solid) evaluation!usages incache-ttl-view.tsx(elapsed()!) andmain-session-view.tsx(messages!) → optional props with runtime guardstests/eager-render.test.ts: rendersTuiHitRowwithtrend=undefinedunder bun's eager load path (verified to fail on the pre-fix!)tests/eager-safe-jsx.test.ts: static scan for guard-variable!derefs and optional-chain-then-bare-deref in src tsx (8 cases)AGENTS.md: new Eager-safe JSX code convention@opentui/solid0.3.0 → 0.4.5 (opencode 1.18.x catalog version); version bump 0.6.3 → 0.6.4Verification
props.trend.colorontrend=undefined; file path (lazy) does not. The fix passes both.Closes #5, #6