Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,13 @@ function codegenReactiveScope(
true,
),
t.callExpression(
t.memberExpression(t.identifier('Symbol'), t.identifier('for')),
t.memberExpression(
t.memberExpression(
t.identifier('globalThis'),
t.identifier('Symbol'),
),
t.identifier('for'),
),
[t.stringLiteral(MEMO_CACHE_SENTINEL)],
),
);
Expand Down Expand Up @@ -968,7 +974,13 @@ function codegenReactiveScope(
'!==',
t.identifier(name),
t.callExpression(
t.memberExpression(t.identifier('Symbol'), t.identifier('for')),
t.memberExpression(
t.memberExpression(
t.identifier('globalThis'),
t.identifier('Symbol'),
),
t.identifier('for'),
),
[t.stringLiteral(EARLY_RETURN_SENTINEL)],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { makeObject_Primitives, mutate } from "shared-runtime";
function Component() {
const $ = _c(1);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
const a = makeObject_Primitives();
const x = [];
x.push(a);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ import { c as _c } from "react/compiler-runtime";
function Component() {
const $ = _c(2);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t0 = someObj();
$[0] = t0;
} else {
t0 = $[0];
}
const a = t0;
let t1;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
if ($[1] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
const x = [];
x.push(a);
t1 = [x, a];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { c as _c } from "react/compiler-runtime";
function component() {
const $ = _c(1);
let x;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
const z = [];
const y = {};
y.z = z;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { c as _c } from "react/compiler-runtime";
function component() {
const $ = _c(1);
let x;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
const z = [];
const y = {};
y.z = z;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function useFoo(cond) {
let s;
let t0;
if ($[0] !== cond) {
t0 = Symbol.for("react.early_return_sentinel");
t0 = globalThis.Symbol.for("react.early_return_sentinel");
bb0: {
if (cond) {
s = {};
Expand All @@ -59,7 +59,7 @@ function useFoo(cond) {
t0 = $[1];
s = $[2];
}
if (t0 !== Symbol.for("react.early_return_sentinel")) {
if (t0 !== globalThis.Symbol.for("react.early_return_sentinel")) {
return t0;
}
return s;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function useFoo(t0) {
let s;
let t1;
if ($[0] !== cond1 || $[1] !== cond2) {
t1 = Symbol.for("react.early_return_sentinel");
t1 = globalThis.Symbol.for("react.early_return_sentinel");
bb0: {
if (cond1) {
s = {};
Expand All @@ -142,7 +142,7 @@ function useFoo(t0) {
t1 = $[2];
s = $[3];
}
if (t1 !== Symbol.for("react.early_return_sentinel")) {
if (t1 !== globalThis.Symbol.for("react.early_return_sentinel")) {
return t1;
}
return s;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function useFoo(t0) {
const $ = _c(3);
const { cond } = t0;
let t1;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t1 = {};
$[0] = t1;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function Foo() {
const $ = _c(1);
try {
let thing;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
thing = null;
if (cond) {
thing = makeObject_Primitives();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function Component(props) {
const $ = _c(1);
const ref = useRef(props.value);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
const object = {};
object.foo = () => ref.current;
t0 = <Stringify object={object} shouldInvokeFns={true} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function Component() {
const $ = _c(1);
const foo = _temp;
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t0 = <div {...foo} />;
$[0] = t0;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function Component() {
const setGlobal = _temp;
let t0;
let t1;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t0 = () => {
setGlobal();
};
Expand All @@ -60,7 +60,7 @@ function Component() {
useEffect(t0, t1);
let t2;
let t3;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
if ($[2] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t2 = () => {
setState(someGlobal.value);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function Component() {
const setGlobal = _temp;
let t0;
let t1;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t0 = () => {
setGlobal();
};
Expand All @@ -59,7 +59,7 @@ function Component() {
useEffect(t0, t1);
let t2;
let t3;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
if ($[2] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t2 = () => {
setState(someGlobal.value);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { useCallback, useEffect, useState } from "react";
function Component() {
const $ = _c(1);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t0 = <div>Ok</div>;
$[0] = t0;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function Component() {
const setGlobal = _temp;
let t0;
let t1;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t0 = () => {
setGlobal();
};
Expand All @@ -59,7 +59,7 @@ function Component() {
useEffect(t0, t1);
let t2;
let t3;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
if ($[2] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t2 = () => {
setState(someGlobal);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function Component() {
const $ = _c(5);
const [state, setState] = useState(someGlobal);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t0 = [];
$[0] = t0;
} else {
Expand All @@ -48,7 +48,7 @@ function Component() {
useEffect(_temp, t0);
let t1;
let t2;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
if ($[1] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t1 = () => {
setState(someGlobal);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function Component() {
const ref2 = useRef(null);
const mergedRef = mergeRefs([ref], ref2);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t0 = <Stringify ref={mergedRef} />;
$[0] = t0;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function Component() {

const y = x;
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t0 = () => {
y.value = "hello";
};
Expand All @@ -72,7 +72,7 @@ function Component() {
useEffect(t0);
let t1;
let t2;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
if ($[1] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t1 = () => {
setState(someGlobal.value);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function Component() {
const $ = _c(2);
const ref = useRef(null);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
const setRef = () => {
if (ref.current !== null) {
ref.current = "";
Expand All @@ -58,7 +58,7 @@ function Component() {
}
const onClick = t0;
let t1;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
if ($[1] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t1 = (
<>
<input ref={ref} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function Component() {
const $ = _c(2);
const ref = useRef(null);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t0 = () => {
if (ref.current !== null) {
ref.current = "";
Expand All @@ -51,7 +51,7 @@ function Component() {
}
const onClick = t0;
let t1;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
if ($[1] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t1 = (
<>
<input ref={ref} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function Component() {
const $ = _c(2);
const ref = useRef(null);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
const setRef = () => {
if (ref.current !== null) {
ref.current.value = "";
Expand All @@ -58,7 +58,7 @@ function Component() {
}
const onClick = t0;
let t1;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
if ($[1] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t1 = (
<>
<input ref={ref} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function Component() {
const $ = _c(2);
const ref = useRef(null);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t0 = () => {
if (ref.current !== null) {
ref.current.value = "";
Expand All @@ -51,7 +51,7 @@ function Component() {
}
const onClick = t0;
let t1;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
if ($[1] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t1 = (
<>
<input ref={ref} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function Component(props) {
const $ = _c(1);
const ref = useRef(null);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t0 = <Foo ref={ref} />;
$[0] = t0;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function Component() {
const $ = _c(1);
const onClick = _temp;
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t0 = <div onClick={onClick} />;
$[0] = t0;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function handleSubmit(callback) {
async function upload(file) {
const $ = _c(1);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t0 = { blob: { url: "https://example.com/file.jpg" } };
$[0] = t0;
} else {
Expand Down Expand Up @@ -112,7 +112,7 @@ function Component() {
const t0 = handleSubmit(onSubmit);
let t1;
let t2;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t1 = <input type="text" name="signature" />;
t2 = <button type="submit">Submit</button>;
$[0] = t1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function Component() {
const ref = useRef(null);
const [state, setState] = useState(false);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
if ($[0] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t0 = () => {
ref.current = "Ok";
};
Expand All @@ -62,7 +62,7 @@ function Component() {
const setRef = t0;
let t1;
let t2;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
if ($[1] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t1 = () => {
setRef();
};
Expand All @@ -76,7 +76,7 @@ function Component() {
useEffect(t1, t2);
let t3;
let t4;
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
if ($[3] === globalThis.Symbol.for("react.memo_cache_sentinel")) {
t3 = () => {
setState(true);
};
Expand Down
Loading
Loading