Skip to content

[Fix] oclite TUI fails to render - React hooks error and JSX pragma mismatch #136

Description

@randomm

Problem

oclite TUI doesn't render - hangs after bootstrap with no visible UI.

Root Causes (from investigation)

Issue 1: React Hooks Error

TypeError: null is not an object (evaluating 'dispatcher.useReducer')

Location: packages/opencode/src/cli/ink/App.tsx:15

Cause: React context not initialized when render(<App />) is called. Likely causes:

  • tsconfig.json has jsxImportSource: "@opentui/solid" but Ink files use /** @jsxImportSource react */
  • Multiple React copies in bundle
  • Bun bundler not handling React/Ink dependencies correctly

Issue 2: Config Loading Slowness

Config loading takes a long time on opencode.work.json with file:prompts/work/*.md references and plugin install checks.

Recommended Fixes

  1. Fix JSX pragma for Ink build:

    • Ensure build-lite.ts uses React JSX for Ink components
    • Or create separate tsconfig for Ink TUI
  2. Verify single React instance:

    • Check Bun bundler output for duplicate React
    • May need to mark React as external or dedupe
  3. Set Log.init print: false:

    • entry.ts:13 - avoid stdout conflicts with Ink

Files

  • packages/opencode/src/cli/ink/App.tsx - line 15
  • packages/opencode/src/cli/ink/entry.ts - line 13
  • packages/opencode/script/build-lite.ts - bundler config
  • packages/opencode/tsconfig.json - JSX config

Acceptance Criteria

  • oclite TUI renders input prompt
  • No React hooks errors
  • Ink components work correctly

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions