@lynx-js/react-canary 0.124.0 → 0.124.1-canary-20260817-47b7d5ca

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @lynx-js/react
2
2
 
3
+ ## 0.124.1-canary-20260817055106-47b7d5ca31a83106c36b9adf8511505e89d9fbc1
4
+
5
+ ### Patch Changes
6
+
7
+ - Tag main-thread vnodes with `$$typeof: Symbol.for('react.element')` so `isValidElement` recognizes them, matching the background thread. ([#3514](https://github.com/lynx-family/lynx-stack/pull/3514))
8
+
3
9
  ## 0.124.0
4
10
 
5
11
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/react-canary",
3
- "version": "0.124.0",
3
+ "version": "0.124.1-canary-20260817-47b7d5ca",
4
4
  "description": "ReactLynx is a framework for developing Lynx applications with familiar React.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -3,6 +3,22 @@
3
3
  // LICENSE file in the root directory of this source tree.
4
4
  import { CHILDREN, COMPONENT, DIFF, DIRTY, DOM, FLAGS, INDEX, PARENT, SnapshotInstance } from '@lynx-js/react/internal';
5
5
 
6
+ // Kept in sync with `REACT_ELEMENT_TYPE` in preact/compat, whose `isValidElement`
7
+ // compares against it. Inlined rather than imported so the main thread does not
8
+ // have to pull in compat.
9
+ const REACT_ELEMENT_TYPE = Symbol.for('react.element');
10
+
11
+ // A SnapshotInstance is the main thread's element, so it has to satisfy
12
+ // `isValidElement` too. Assigning per instance would add a property after the
13
+ // constructor has run, which costs a shape transition on a hot path, so put it
14
+ // on the prototype instead. Writable, so that the `$$typeof: undefined` in
15
+ // `renderToOpcodes` can still shadow it.
16
+ Object.defineProperty(SnapshotInstance.prototype, '$$typeof', {
17
+ value: REACT_ELEMENT_TYPE,
18
+ writable: true,
19
+ configurable: true,
20
+ });
21
+
6
22
  function createVNode(type, props, _key) {
7
23
  if (typeof type === 'string') {
8
24
  const r = new SnapshotInstance(type);
@@ -58,6 +74,7 @@ function createVNode(type, props, _key) {
58
74
  // __v: --vnodeId,
59
75
  [INDEX]: -1,
60
76
  [FLAGS]: 0,
77
+ $$typeof: REACT_ELEMENT_TYPE,
61
78
  };
62
79
  }
63
80
  }