@lynx-js/react
0.116.3
Patch Changes
-
fix: remove
lynx.createSelectorQuerydeprecated warning in production (#2195) -
Add a DEV-only guard that detects MainThread flush loops caused by re-entrant MTS handlers. (#2159)
This typically happens when a MainThread handler (e.g. event callback or
MainThreadRef) performs UI mutations (likeElement.setStyleProperty,setStyleProperties,setAttribute, orinvoke) that synchronously trigger a flush which re-enters the handler again. -
Avoid DEV_ONLY_SetSnapshotEntryName on standalone lazy bundle. (#2184)
-
Add alog and trace for BTS event handlers. (#2102)
-
fix: Main thread functions cannot access properties on
thisbefore hydration completes. (#2194)This fixes the
cannot convert to objecterror. -
Remove element api calls alog by default, and only enable it when
__ALOG_ELEMENT_API__is defined totrueor environment variableREACT_ALOG_ELEMENT_APIis set totrue. (#2192) -
fix: captured variables in main thread functions within class components do not update correctly (#2197)
0.116.2
Patch Changes
-
Fix "TypeError: not a function" error caused by
replaceAllnot supported in ES5. (#2142) -
Bump
swc_corev56. (#2154) -
Use
disableDeprecatedWarningoption to suppress BROKEN warnings during compilation. (#2157)- BROKEN:
getNodeRef/getNodeRefFromRoot/createSelectorQueryon component instance is broken and MUST be migrated in ReactLynx 3.0, please use ref or lynx.createSelectorQuery instead. - BROKEN:
getElementByIdon component instance is broken and MUST be migrated in ReactLynx 3.0, please use ref or lynx.getElementById instead.
- BROKEN:
-
Fix memory leak by clearing list callbacks when __DestroyLifetime event is triggered. (#2112)
0.116.1
Patch Changes
- Fix the issue that lazy bundle HMR will lost CSS. (#2134)
0.116.0
Minor Changes
- BREAKING CHANGE: Bump Preact from 10.24.0 to 10.28.0, see diffs at hzy/preact#6. (#2042)
Patch Changes
-
Add safety checks for compilation macros to prevent runtime errors when they are undefined. (#2110)
Replaces direct usage of
__PROFILE__,__MAIN_THREAD__,__BACKGROUND__withtypeofchecks.This improves robustness by checking variable existence before access, preventing runtime errors in environments where compilation macros are not defined.
0.115.4
Patch Changes
-
fix: unable to access
MainThreadRefin some scenarios (#1996) -
Add
getComputedStylePropertyforMainThread.Elementto retrieve computed style values synchronously. (#2005)Requires Lynx SDK >= 3.5
0.115.3
Patch Changes
-
Add dual-thread commutation logs for troubleshooting when
REACT_ALOG=trueor global define__ALOG__is set. (#2081) -
Use error cause to simplify the error msg of lazy bundle loading. User can catch the error cause to get the original result: (#2056)
0.115.2
Patch Changes
-
Fix
undefined factory (react:background)/./node_modules/.pnpm/@lynx-js+react...error when loading a standalone lazy bundle after hydration. (#2048) -
Partially fix "main-thread.js exception: TypeError: cannot read property '__elements' of undefined" by recursively calling
snapshotDestroyList. (#2041) -
Fix a bug where React throws
CtxNotFounderror when lazy bundle resolves after unmount. (#2003)
0.115.1
Patch Changes
-
Auto define lynx.loadLazyBundle when using
import(/* relative path */). (#1956) -
feat: support declaring cross-thread shared modules via Import Attributes, enabling Main Thread Functions to call standard JS functions directly. (#1968)
-
Usage: Add
with { runtime: "shared" }to theimportstatement. For example: -
Limitations:
- Only directly imported identifiers are treated as shared; assigning the import to a new variable will result in the loss of this shared capability.
- Functions defined within shared modules do not automatically become Main Thread Functions. Accessing main-thread-only APIs (e.g.,
MainThreadRef) will cause errors.
-
0.115.0
Minor Changes
-
BREAKING CHANGE: Delay the
createSnapshotoperation toSnapshotconstructor to speed up IFR. (#1899)This change refactors how snapshots are created and registered:
- Removed the
entryUniqIDfunction - Snapshots are now lazily created via
snapshotCreatorMapinstead of eagerly at bundle load time - Snapshot IDs are generated at compile time and only prefixed with
${globDynamicComponentEntry}:for standalone lazy bundles
⚠️ Lazy Bundle Compatibility:
-
Backward compatibility (new runtime → old lazy bundles): ✅ Supported. Old lazy bundles will work with the new runtime.
-
Forward compatibility (old runtime → new lazy bundles): ❌ NOT Supported. Lower version consumers will not be able to load lazy bundles produced by this version due to the changed snapshot creation mechanism.
Migration guidance: If you are using lazy bundles, ensure all consumers are upgraded to this version or later before deploying lazy bundles built with this version. For monorepo setups, coordinate the upgrade across all consuming applications.
- Removed the
Patch Changes
-
Preserve assignments to webpack runtime variables like
__webpack_public_path__,__webpack_require__.p, etc. (#1958) -
Fixed blank screen issues with nested lists. Lazily created nested lists were being flushed but not properly recorded, causing rendering failures. (#1963)
-
fix: export
createRefanduseReffrom@lynx-js/react/legacy-react-runtime(#1953)
0.114.5
Patch Changes
- Reduce
__SetInlineStyleselement API call when attrs in spread not changed (#1919)
0.114.4
Patch Changes
-
During hydration, replace update with insert + remove for same-type
<list-item />with differentitem-keyso the Lynx Engine detects changes. (#1598)Previously this case was hydrated as an update; it is now emitted as insert + remove to ensure SDK detection.
-
Bump
swc_corev47. (#1916) -
Pass sourcemap generated by rspack to swc transformer. (#1910)
-
When engineVersion is greater than or equal to 3.1, use
__SetAttributeto set text attribute for text node instead of creating a raw text node. (#1880) -
Add profile for list
update-list-info. (#1480) -
Support testing React Compiler in testing library. Enable React Compiler by setting the
experimental_enableReactCompileroption ofcreateVitestConfigtotrue. (#1269)
0.114.3
Patch Changes
-
Initialize
ctxNotFoundEventListenerbefore each test in testing library (#1888) -
fix: main thread functions created during the initial render cannot correctly modify
MainThreadRefs after hydration (#1884)
0.114.2
Patch Changes
- fix: main thread functions created during the initial render cannot correctly call
runOnBackground()after hydration (#1878)
0.114.1
Patch Changes
-
Add
event.stopPropagationandevent.stopImmediatePropagationin MTS, to help with event propagation control (#1835)Note, if this feature is used in Lazy Loading Standalone Project, both the Producer and the Consumer should update to latest version of
@lynx-js/reactto make sure the feature is available. -
Fix the "ReferenceError: Node is not defined" error. (#1850)
This error would happen when upgrading to
@testing-library/jest-domv6.9.0. -
fix: optimize main thread event error message (#1838)
0.114.0
Minor Changes
-
Partially fix the "cannot read property 'update' of undefined" error. (#1771)
This error happens when rendering a JSX expression in a background-only context.
See lynx-family/lynx-stack#894 for more details.
Patch Changes
-
Reduce extra snapshot when children are pure text (#1562)
-
feat: Support
SelectorQueryanimationAPIs (#1768) -
Fix spread props inside list-item caused redundant snapshot patch (#1760)
-
fix:
ref is not initializederror on template reload (#1757)
0.113.0
Minor Changes
-
fix: Delay execution of
runOnMainThread()during initial render (#1667)When called during the initial render,
runOnMainThread()would execute before themain-thread:refwas hydrated, causing it to be incorrectly set to null.This change delays the function's execution to ensure the ref is available and correctly assigned.
Patch Changes
-
Fix "TypeError: cannot read property '0' of undefined" in deferred list-item scenarios. (#1692)
Deferred
componentAtIndexcauses nodes that quickly appear/disappear to be enqueued without__elements. UpdatesignMapbefore__FlushElementTreeto resolve the issue. -
Keep the same
<page/>element when callingrerenderin testing library. (#1656) -
Bump
swc_coreto39.0.3. (#1721)
0.112.6
Patch Changes
-
Support nested list. (#1581)
-
Should only recycle off-screen
list-itemin recursive hydration. (#1641) -
fix
fireEventtype error in testing library (#1596)
0.112.5
Patch Changes
- Remove the "key is not on root element of snapshot" warning. (#1558)
0.112.4
Patch Changes
-
fix
withInitDataInStategot wrong state in 2nd or more timesdefaultDataProcessor, now it will keep its own state. (#1478) -
change
__CreateElement('raw-text')to__CreateRawText('')to avoidsetNativePropsnot working (#1570) -
Fix wrong render result when using expression as
key. (#1541)See lynx-family/lynx-stack#1371 for more details.
-
fix:
Cannot read properties of undefinederror when usingSuspense(#1569) -
Add
animateAPI in Main Thread Script(MTS), so you can now control a CSS animation imperatively (#1534)
0.112.3
Patch Changes
-
fix css transform error in testing library (#1500)
-
fix the type error of
wrapperoption in testing library'srenderandrenderHookfunction (#1502) -
Introduce recursive hydration for lists to prevent double remove/insert on moves. (#1401)
-
Handle
<frame/>correctly. (#1497)
0.112.2
Patch Changes
-
Supports
recyclableattribute in<list-item>to control whether the list item is recyclable. Therecyclableattribute depends on Lynx Engine 3.4 or later. (#1388) -
feat: Support using a host element as direct child of Suspense (#1455)
-
Add profile in production build: (#1336)
diff:__COMPONENT_NAME__: how long ReactLynx diff took.render:__COMPONENT_NAME__: how long your render function took.setState: an instant trace event, indicate when your setState was called.
NOTE:
__COMPONENT_NAME__may be unreadable when minified, settingdisplayNamemay help. -
Add
onBackgroundSnapshotInstanceUpdateIdevent on dev for Preact Devtools to keep the correct snapshotInstanceId info. (#1173) -
fix: Prevent error when spreading component props onto an element (#1459)
-
fix: Correctly check for the existence of background functions in MTS (#1416)
0.112.1
Patch Changes
-
Fix crash caused by not removing event listeners during destroy. (#1379)
-
Fix missing "type" in "update-list-info" in hydrate (#1392)
0.112.0
Minor Changes
-
feat: Force synchronous rendering for background initial renders to support Suspense fallbacks (#1323)
-
Introduces
@lynx-js/react/compatsubmodule exporting Preact implementations of: (#1316)startTransitionuseTransition
Patch Changes
-
fix: Ensure useEffect callbacks execute before event handlers from the same render cycle (#1348)
-
Enable rendering of the
Suspensefallback on initial render. (#1285) -
fix: Prevent "cannot set property 'current' of undefined" error thrown by MainThreadRef on engine data updates (#1342)
0.111.2
Patch Changes
-
Optimize
componentAtIndexby a few hundreds microseconds: avoiding manipulate__pendingListUpdatesunless SnapshotInstance tree is changed (#1201) -
Support alog of component rendering on production for better error reporting. Enable it by using
REACT_ALOG=true rspeedy dev/buildor defining__ALOG__totrueinlynx.config.js: (#1164) -
Make
preact/debugwork with@lynx-js/react. (#1222) -
Introduce
@lynx-js/react/debugwhich would include debugging warnings and error messages for common mistakes found. (#1250)Add the import to
@lynx-js/react/debugat the first line of the entry: -
<list-item/>deferred now accepts an object withunmountRecycledproperty to control unmounting behavior when the item is recycled. (#1302)For example, you can use it like this:
Now the component will be unmounted when it is recycled, which can help with performance in certain scenarios.
-
Avoid some unexpected
__SetAttributein hydrate whenundefinedis passed as an attribute value to intrinsic elements, for example: (#1318)
0.111.1
Patch Changes
- Wrap the main thread
renderPagein preactactto ensure that the effects are flushed. (#1170)
0.111.0
Minor Changes
-
Allow some
<list-item/>s to be deferred and rendered in the background thread. (#204)Use the following syntax:
You should render your heavyweight components with the
deferattribute to avoid blocking the main thread.
Patch Changes
-
Add missing alias of
@lynx-js/reactandpreactin testing library, it will fix theFailed to resolve import "@lynx-js/react/internal"error in node_modules. (#1182) -
Allow any types of
dataProcessorsinlynx.registerDataProcessors. (#1200) -
Make
loadLazyBundlebeing able to render the content on the first screen of the background thread. (#1212) -
Fixed: An issue where the
lynxViewDidUpdatecallback did not trigger when data was updated from native. (#1171)Notice:
- Even if no data changes are actually processed after calling
updateData(), thelynxViewDidUpdatecallback will still be triggered. - Only one
lynxViewDidUpdatecallback will be triggered per render cycle. Consequently, if multipleupdateData()calls are made within a single cycle but the data updates are batched, the number oflynxViewDidUpdatecallbacks triggered may be less than the number ofupdateData()calls.
- Even if no data changes are actually processed after calling
-
Supports
actin testing library. (#1182)
0.110.1
Patch Changes
- Fix a memory leak when using
<list/>. (#1144)
0.110.0
Minor Changes
-
Fixed closure variable capture issue in effect hooks to prevent stale values and ensured proper execution order between refs, effects, and event handlers. (#770)
Breaking Changes:
- The execution timing of
ref,useEffect()callback,componentDidMount,componentDidUpdate,componentWillUnmountand the callback ofsetStatehave been moved forward. These effects will now execute before hydration is complete, rather than waiting for the main thread update to complete. - For components inside
<list />,refcallbacks will now be triggered during background thread rendering, regardless of component visibility. If your code depends on component visibility timing, usemain-thread:refinstead of regularref.
- The execution timing of
Patch Changes
-
Fixed two memory leaks: (#1071)
-
When JSX is rendered on the main thread and removed, FiberElement can still be referenced by
__root.__jsxthroughprops.children; -
When the SnapshotInstance tree is removed from the root node, its child nodes form a cycle reference because the
__previousSiblingand__nextSiblingproperties point to each other, thus causing a FiberElement leak.
-
-
Optimize the error message when snapshots cannot be found in the main thread. (#1083)
-
Fix a problem causing
MainThreadRefs to not be updated correctly during hydration when they are set tomain-thread:refs. (#1001) -
Add snapshot id report when throwing
snapshotPatchApply failed: ctx not founderror. (#1107) -
Fix a bug in ReactLynx Testing Library that rendered snapshot of inline style was normalized incorrectly (eg.
flex:1was normalized toflex: 1 1 0%;incorrectly). (#1040)
0.109.2
Patch Changes
-
Support for locating errors in the source code directly on the device when exceptions occur when using MTS. (#1019)
This requires Lynx engine v3.4 or later.
-
Fix the "main-thread.js exception: ReferenceError:
__webpack_require__is not defined" error in HMR. (#985)This error occurred when setting
output.iife: true, which is the default value in@lynx-js/rspeedyv0.9.8.
0.109.1
Patch Changes
-
Support the 'main-thread' directive as an alias for 'main thread'. (#970)
-
Reduce calls to
__AddInlineStyleby pass non-literal object directly to__SetInlineStyles. (#941)
0.109.0
Minor Changes
- Support MTS functions running on the first screen. (#840)
Patch Changes
-
Fix type error when using
Suspensewith"jsx": "react-jsx". (#854) -
Support lazy bundle in ReactLynx testing library. (#869)
-
Fix a bug in HMR that snapshots are always updated because the same unique ID check is not performed correctly. (#869)
-
Fix missing types of
keyon components when using"jsx": "react-jsx". (#872)
0.108.1
Patch Changes
- Bump swc_core v23.2.0. (#827)
0.108.0
Minor Changes
-
Reverts #239: "batch multiple patches for main thread communication" (#649)
This reverts the change that batched updates sent to the main thread in a single render pass.
Patch Changes
-
Add support for batch rendering in
<list>with async resolution of sub-tree properties and element trees. (#624)Use the
experimental-batch-render-strategyattribute of<list>: -
rename @lynx-js/test-environment to @lynx-js/testing-environment (#704)
-
Auto import
@lynx-js/react/experimental/lazy/importwhen usingimport(url)(#667) -
Auto import
@lynx-js/react/experimental/lazy/importwhen using<component is={url} />(#666) -
Fixed a race condition when updating states and GlobalProps simultaneously. (#707)
This fix prevents the "Attempt to render more than one
<page />" error from occurring during normal application usage. -
Fix error like
Unterminated string constantwhen using multi-line JSX StringLiteral. (#654)
0.107.1
Patch Changes
- Fix error
OnPipelineStart arg count must == 1on app load. (#669)
0.107.0
Minor Changes
-
Some of the timing keys are renamed to match the naming convention of the Lynx Engine. (#438)
update_set_state_trigger->updateSetStateTriggerupdate_diff_vdom_start->updateDiffVdomStartupdate_diff_vdom_end->updateDiffVdomEnddiff_vdom_start->diffVdomStartdiff_vdom_end->diffVdomEndpack_changes_start->packChangesStartpack_changes_end->packChangesEndparse_changes_start->parseChangesStartparse_changes_end->parseChangesEndpatch_changes_start->patchChangesStartpatch_changes_end->patchChangesEndhydrate_parse_snapshot_start->hydrateParseSnapshotStarthydrate_parse_snapshot_end->hydrateParseSnapshotEndmts_render_start->mtsRenderStartmts_render_end->mtsRenderEnd
Patch Changes
-
Add testing library for ReactLynx (#74)
-
Refactor: Improved naming for list operation related types. Renamed
UpdateActioninterface toListOperations. (#592) -
Support using
"jsx": "react-jsx"along with"jsxImportSource": "@lynx-js/react"intsconfig.json. (#545)This configuration enhances TypeScript definitions for standard JSX elements, providing type errors for unsupported elements like
<div>or<button>. -
fix: JSX elements with dynamic
key={expr}now wrapped inwrapperelement to prevent merging. (#547)
0.106.5
Patch Changes
-
Fix
lynx.loadLazyBundleis not a function (#568) -
fix: flushDelayedLifecycleEvents stack overflow error (#540)
0.106.4
Patch Changes
- Disable MTS HMR functionality temporarily to address stability issues. This is a temporary fix while we work on a more robust solution. (#512)
0.106.3
Patch Changes
-
Do some global var initialize in hydrate, which fixes error like
cannot read property '-21' of undefinedand some style issue. (#461) -
fix: ensure ref lifecycle events run after firstScreen in the background thread (#434)
This patch fixes an issue where ref lifecycle events were running before firstScreen events in the background thread async render mode, which could cause refs to be undefined when components try to access them.
0.106.2
Patch Changes
-
fix: prevent multiple firstScreen events when reloading before
jsReady(#377) -
Optimize the bundle size by eliminating unnecessary code when the lazy bundle is not utilized. (#284)
0.106.1
Patch Changes
- Fix a stack underflow issue when running on PrimJS. (#326)
0.106.0
Minor Changes
-
Improved rendering performance by batching updates sent to the main thread in a single render pass. This optimization reduces redundant layout operations on the main thread, accelerates rendering, and prevents screen flickering. (#239)
BREAKING CHANGE: This commit changes the behavior of Timing API. Previously, timing events were fired for each update individually. With the new batching mechanism, timing events related to the rendering pipeline will now be triggered once per render cycle rather than for each individual update, affecting applications that rely on the previous timing behavior.
Patch Changes
-
Add missing typing for
useErrorBoundary. (#263)You can now use
useErrorBoundaryit in TypeScript like this: -
Modified the format of data sent from background threads to the main thread. (#207)
-
Support Lynx SSR. (#60)
0.105.2
Patch Changes
-
Support new css properties:
offset-pathandoffset-distance(#152) -
Fix 'SystemInfo is not defined' error when using MTS and not importing anything manually from the react package. (#172)
-
Fix
not a functionerror when using lazy bundle without MTS. (#170) -
fix: gesture config not processed correctly (#175)
After this commit, gesture config like
minDistanceshould work as expected.
0.105.1
Patch Changes
-
Support NPM provenance. (#30)
-
feat: add compiler only version of addComponentElement, it does not support spread props but have no runtime overhead, use it by: (#15)
-
Fix error
createRef is not a function(#16) -
Support
MIXEDtarget for worklet, it will be used by unit testing frameworks, etc. (#27) -
Support return value for
runOnBackground()andrunOnMainThread(). (#119)Now you can get the return value from
runOnBackground()andrunOnMainThread(), which enables more flexible data flow between the main thread and the background thread.
0.105.0
Minor Changes
-
1abf8f0: Support
estimated-main-axis-size-pxNOTE: This changes behavior of
transformReactLynxso certain features (like lazy bundle) will be BROKEN if version mismatch. -
1abf8f0: Support JSXSpread on
<list-item/>component.NOTE: This changes behavior of
transformReactLynxso certain features (like lazy bundle) will be BROKEN if version mismatch.
Patch Changes
- 1abf8f0: Update readme.
- 1abf8f0: Save some bytes if
<page/>is not used. - 1abf8f0: Should escape newline character in jsx
0.104.1
Patch Changes
-
9ce9ec0: Fix argument cannot be accessed correctly in default exported MTS functions.
-
99a4de6: Change TypeScript configuration to improve tree-shaking by setting
verbatimModuleSyntax: false.This change allows the bundler to properly remove unused imports and type-only imports, resulting in smaller bundle sizes. For example:
See TypeScript - verbatimModuleSyntax for details.
0.104.0
Minor Changes
- 575e804: Remove misleading API
createRoot
Patch Changes
- 797ff68: Workaround the
cannot find module './snapshot/event.js'error avoid tree-shakingevent.jsin development. - 1bf9271: fix(react): default
compatin transform tofalse
0.103.5
Patch Changes
- 74e0ea3: Supports new
__MAIN_THREAD__and__BACKGROUND__macro as an alternative to__LEPUS__and__JS__.
0.103.4
Patch Changes
- 89a9f7a: Improve the speed of MTS.
0.103.3
Patch Changes
-
4e94846: Fix variables being renamed in MTS.
-
297c6ea: Fix the issue that when
runOnBackground()'s parameter is not legal, it will still report an error in the rendering process of the background thread even though it won't actually be called. -
763ad4e: Stop reporting ctx id in the
ctx not founderror. -
480611d: Avoid error from changing theme.
-
3bf5830: Avoid overriding
processEvalResult.
0.103.2
Patch Changes
- 580ce54: Fix snapshot not found in HMR updates.
0.103.1
Patch Changes
- 80a4e38: Use hooks
useLynxGlobalEventListenerto makeuseInitDataaddListener as early as possible. This will fix the issue thatonDataChangedhas been called before the event listener is added. - 8aa3979: Fix generating wrong JavaScript when using a variable multiple times in the main thread script.
- 318245e: Avoid snapshot ID conflict between different templates and bundles.
- b520862: Remove unnecessary sideEffects to reduce bundle size.
- 7cd840c: Integrate with
@lynx-js/types.
0.103.0
Minor Changes
-
a30c83d: Add
compat.removeComponentAttrRegex.NOTE: This feature is deprecated and will be removed in the future. Use codemod instead.
-
5f8d492: Deprecate
compat.simplifyCtorLikeReactLynx2
Patch Changes
-
ca3a639: Fix
cssIdcollision issue when hash generated@jsxCSSIdfor jsx snapshot hit the range of auto increased cssId of@file. -
8fbea78: Fix 'main thread' and 'background only' directives not working in export default declarations.
-
ff18049: Bump swc_core v0.109.2.
This would add
/*#__PURE__*/to the output of TypeScriptenum. See swc-project/swc#9558 for details.
0.102.0
Minor Changes
- e3be842: Fix some attribute updating of nodes in list does not take effect
- 2e6b549: Add ability to be compat with pre-0.99 version of ReactLynx
Patch Changes
- 75725cb: Fix a memory leak in MTS.
- 09e0ec0: Reduce the size of
background.js. - 9e40f33: Slightly improve MTS execution speed.
- f24599e: Fix the infinite mount and unmount loops of lazy bundle when its JS file fails to execute.
0.101.0
Minor Changes
-
6730c58: Change the snapshot transform result by adding
cssIdandentryName.This requires
@lynx-js/react-rsbuild-pluginv0.5.1 to work. -
efbb7d4: Support Gesture.
Gesture Handler is a set of gesture handling capabilities built on top of the Main Thread Script. It currently supports drag, inertial scrolling, long press, and tap gestures for
<view>,<scroll-view>,<list>, and<text>. In the future, it will also support multi-finger zoom, multi-finger rotation, and other gesture capabilities.
Patch Changes
-
b2032eb: Better DCE.
Now DCE can remove dead branch:
-
45edafa: Support using
import()with variables.
0.100.0
Minor Changes
- 587a782: Release
@lynx-js/reactv0.100.0
Patch Changes
- a335490: Fix an issue where events might not fire after calling
ReloadTemplate.

