Description
Summary
Code blocks fail to render when the worker-based syntax highlighting pipeline fails to initialize. The worker pool remains uninitialized (initialized: false, empty language registry) and may not emit a reliable error event. As a result, no highlighted HTML is generated and code blocks do not render, causing dependent UI elements such as expand/collapse to break due to missing content.
This has been observed in Android production builds when the OpenCode web UI is loaded inside an Expo React Native WebView. It does not reproduce in desktop browsers or Android debug/emulator builds.
Observed Behavior
- Worker pool remains uninitialized (
initialized: false)
- Empty language registry
- No reliable error event emitted
- Syntax highlighting does not render
- Code blocks do not render
- Expand/collapse UI appears broken due to missing content
Expected Behavior
Worker initialization failure should trigger a fallback to main-thread highlighting instead of leaving the system in an uninitialized state.
Proposed Fix
Wrap worker initialization in a Promise.race between:
- successful initialization
- worker error event
- timeout
If worker initialization does not successfully complete before error/timeout, fallback to main thread
Scope
No behavior change in environments where workers function correctly. This only adds a fallback path for initialization failure cases.
Plugins
None
OpenCode version
1.14.48
St
[Truncado — 3331 chars totais]
Description
Summary
Code blocks fail to render when the worker-based syntax highlighting pipeline fails to initialize. The worker pool remains uninitialized (
initialized: false, empty language registry) and may not emit a reliable error event. As a result, no highlighted HTML is generated and code blocks do not render, causing dependent UI elements such as expand/collapse to break due to missing content.This has been observed in Android production builds when the OpenCode web UI is loaded inside an Expo React Native WebView. It does not reproduce in desktop browsers or Android debug/emulator builds.
Observed Behavior
initialized: false)Expected Behavior
Worker initialization failure should trigger a fallback to main-thread highlighting instead of leaving the system in an uninitialized state.
Proposed Fix
Wrap worker initialization in a
Promise.racebetween:If worker initialization does not successfully complete before error/timeout, fallback to main thread
Scope
No behavior change in environments where workers function correctly. This only adds a fallback path for initialization failure cases.
Plugins
None
OpenCode version
1.14.48
St