Repository navigation
fix(lynx): expose SystemInfo global on the main thread - #411
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
4 tasks done
This branch was previously deployed
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
installLynxMainThread()exposesSystemInfoas a bare global on the main-thread target when the engine only provides it aslynx.SystemInfo.Why
SystemInfois not a global — it lives atlynx.SystemInfo. Authored'main thread'functions use the documented bare global (for example the official Product Gallery tutorial's scrollbar math), and on device they threwReferenceError: SystemInfo is not defined(Lynx Explorer 3.9, iOS).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, iftarget.SystemInfois undefined, assigntarget.lynx?.SystemInfo ?? {}. An explicit test-provided global is never overwritten.Validation
vitest run --project lynx— 259 tests passedtsgo --noEmit -p packages/lynx/tsconfig.jsonprettier --checkon the changed file'main thread'functions readingSystemInfo.pixelHeight/pixelRatiorun on Lynx Explorer 3.9 (iOS) with this changeRisk / follow-ups
@octanejs/lynxis 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 bareSystemInfoglobal when the native main thread only exposes it aslynx.SystemInfo, matching ReactLynx worklet env setup.During install, if
target.SystemInfois missing, it is set tolynx.SystemInfoor{}; an existing global (e.g. from tests) is left unchanged. This fixesReferenceError: SystemInfo is not definedfor authored'main thread'worklets that readSystemInfo.pixelHeight/pixelRatioon device.Reviewed by Cursor Bugbot for commit 81a09e5. Bugbot is set up for automated code reviews on this repo. Configure here.