Skip to content

fix(lynx): unwrap main-thread event props in first-screen host batches - #413

Merged
trueadm merged 1 commit into
octanejs:mainfrom
Huxpro:fix/lynx-first-screen-mts-event-props
Jul 30, 2026
Merged

trueadm merged 1 commit into
octanejs:mainfrom
Huxpro:fix/lynx-first-screen-mts-event-props

Conversation

@Huxpro

@Huxpro Huxpro commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The host driver's cloneProps unwraps main-thread: event props from compiler-tagged callables to their plain worklet descriptors, mirroring what the background client driver already does before transport.

Why

  • In the render-only main graph, a main-thread:bind* prop's value is the compiler-tagged callable returned by bindThreadFunction. The background path converts these to descriptors in prepareLynxClientWorkletBatch, but the synchronous first-screen path fed the raw function into cloneHostValue, which rejects functions — so any page authoring a main-thread: event failed its first-screen render on device with Octane Lynx host: host props contain unsupported value function bound() … (Lynx Explorer 3.9, iOS) and fell back to the failed-first-screen path.
  • With the unwrap, first screens carrying main-thread: events render synchronously and their worklet listeners install through the existing planLynxHostPropPatch path.

Changes

  • host-driver.ts: cloneProps rewrites main-thread:* (except main-thread:ref) function values through getThreadFunctionDescriptor before cloning; untagged functions still fail through cloneHostValue exactly as before.

Validation

  • vitest run --project lynx — 259 tests passed
  • tsgo --noEmit -p packages/lynx/tsconfig.json
  • prettier --check on the changed file
  • device evidence: the Product Detail (swiper) tutorial port — main-thread:bindtouchstart/move/end + main-thread:ref on the first screen — renders synchronously and is draggable on Lynx Explorer 3.9 (iOS) with this change

Risk / follow-ups

  • Only main-thread:-prefixed props are affected; ordinary bind* first-screen handlers keep their event-marker replacement. Depends conceptually on the sibling worklet-capture fixes for full device behavior but is independently correct and mergeable. No changeset: @octanejs/lynx is private.

Note

Low Risk
Narrow change to first-screen prop cloning for main-thread event props only; aligns host behavior with the existing client driver path and leaves ordinary bind handlers unchanged.

Overview
Fixes synchronous first-screen rendering when pages use main-thread: event handlers (e.g. main-thread:bindtouchstart) in the render-only main graph.

cloneProps in the host driver now unwraps compiler-tagged callables on main-thread:* props (except main-thread:ref) to plain worklet descriptors via getThreadFunctionDescriptor before cloneHostValue runs—matching what the background client driver already does before transport. Previously the first-screen path passed raw functions into cloning, which rejected them and broke the initial render on device.

Untagged functions and non–main-thread props behave as before; worklet listeners still install through the existing planLynxHostPropPatch path once descriptors are in props.

Reviewed by Cursor Bugbot for commit 4d6064b. 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:28am
octane-website-mcp Ready Ready Preview Jul 30, 2026 8:28am

Request Review

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

This branch was previously deployed

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