Skip to content

fix(lynx): expose SystemInfo global on the main thread - #411

Merged
trueadm merged 1 commit into
octanejs:mainfrom
Huxpro:fix/lynx-main-thread-systeminfo
Jul 30, 2026
Merged

trueadm merged 1 commit into
octanejs:mainfrom
Huxpro:fix/lynx-main-thread-systeminfo

Conversation

@Huxpro

@Huxpro Huxpro commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • installLynxMainThread() exposes SystemInfo as a bare global on the main-thread target when the engine only provides it as lynx.SystemInfo.

Why

  • On the native main thread, SystemInfo is not a global — it lives at lynx.SystemInfo. Authored 'main thread' functions use the documented bare global (for example the official Product Gallery tutorial's scrollbar math), and on device they threw ReferenceError: SystemInfo is not defined (Lynx Explorer 3.9, iOS).
  • ReactLynx's main-thread environment setup does exactly this bridge (setupLynxEnv: globalThis.SystemInfo = lynx.SystemInfo ?? {}); Octane's main runtime installs its receiver on the same context and needs the same bridge.

Changes

  • main-thread.ts: during install, if target.SystemInfo is undefined, assign target.lynx?.SystemInfo ?? {}. An explicit test-provided global is never overwritten.

Validation

  • vitest run --project lynx — 259 tests passed
  • tsgo --noEmit -p packages/lynx/tsconfig.json
  • prettier --check on the changed file
  • device evidence: 'main thread' functions reading SystemInfo.pixelHeight / pixelRatio run on Lynx Explorer 3.9 (iOS) with this change

Risk / follow-ups

  • The bridge is install-time, idempotent, and skipped when a host already defines the global (JS testing environment installs its own). No changeset: @octanejs/lynx is private.

Note

Low Risk
Small, idempotent install-time global alias with no overwrite of host-provided SystemInfo; limited to main-thread environment setup.

Overview
installLynxMainThread() now bridges the documented bare SystemInfo global when the native main thread only exposes it as lynx.SystemInfo, matching ReactLynx worklet env setup.

During install, if target.SystemInfo is missing, it is set to lynx.SystemInfo or {}; an existing global (e.g. from tests) is left unchanged. This fixes ReferenceError: SystemInfo is not defined for authored 'main thread' worklets that read SystemInfo.pixelHeight / pixelRatio on device.

Reviewed by Cursor Bugbot for commit 81a09e5. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
octane-website Ready Ready Preview Jul 30, 2026 8:24am
octane-website-mcp Ready Ready Preview Jul 30, 2026 8:24am

Request Review

@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp July 30, 2026 08:23 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website July 30, 2026 08:24 Inactive
@trueadm
trueadm merged commit 9a0666b into octanejs:main Jul 30, 2026
28 checks passed

This branch was previously deployed

2 inactive deployments
Preview – octane-website — 81a09e5a Deployed Jul 30, 2026 by vercel[bot]
Preview – octane-website-mcp — 81a09e5a Deployed Jul 30, 2026 by vercel[bot]
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.

2 participants