Skip to content

Commit fae70c9

Browse files
author
yi.wang.sh
committed
fix: fix signals are not reactive on lazy imported components.(#301)
1 parent 9a5cbbd commit fae70c9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/react/src/index.ts

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export { signal, computed, batch, effect, Signal, type ReadonlySignal };
2424
const Empty = [] as const;
2525
const ReactElemType = Symbol.for("react.element"); // https://github.com/facebook/react/blob/346c7d4c43a0717302d446da9e7423a8e28d8996/packages/shared/ReactSymbols.js#L15
2626
const ReactMemoType = Symbol.for("react.memo"); // https://github.com/facebook/react/blob/346c7d4c43a0717302d446da9e7423a8e28d8996/packages/shared/ReactSymbols.js#L30
27+
const ReactLazyType = Symbol.for("react.lazy"); // https://github.com/facebook/react/blob/346c7d4c43a0717302d446da9e7423a8e28d8996/packages/shared/ReactSymbols.js#L31
2728
const ProxyInstance = new WeakMap<
2829
FunctionComponent<any>,
2930
FunctionComponent<any>
@@ -166,6 +167,10 @@ function WrapJsx<T>(jsx: T): T {
166167
return jsx.call(jsx, type, props, ...rest);
167168
}
168169

170+
if (type && typeof type === "object" && type.$$typeof === ReactLazyType) {
171+
return jsx.call(jsx, ProxyFunctionalComponent(type._init(type._payload)), props, ...rest);
172+
}
173+
169174
if (typeof type === "string" && props) {
170175
for (let i in props) {
171176
let v = props[i];

0 commit comments

Comments
 (0)