Files
oxc-project__oxc/crates/oxc_react_compiler/tests/snapshots/readonly-object-method-calls-mutable-lambda.snap
Boshen 48e917fcba fix(react-compiler): preserve tagged template runtime semantics (#25678)
Preserve tagged-template call, aliasing, and mutation effects instead of assuming no-substitution tags are primitive or pure.

Execute opaque or effectful tags unconditionally while retaining memoization only when a configured signature proves a read-only pure call and safe return.

AI-assisted investigation and implementation; reviewed and understood by the contributor.
2026-08-15 05:12:06 +00:00

32 lines
731 B
Plaintext

---
source: crates/oxc_react_compiler/tests/snapshot.rs
input_file: crates/oxc_react_compiler/fixtures/readonly-object-method-calls-mutable-lambda.js
---
import { c as _c } from "react/compiler-runtime";
import { useFragment } from "shared-runtime";
function Component(props) {
const $ = _c(2);
const x = makeObject();
const user = useFragment(graphql`
fragment Component_user on User {
name
}
`, props.user);
const posts = user.timeline.posts.edges.nodes.map((node) => {
x.y = true;
return <Post post={node} />;
});
posts.push({});
const count = posts.length;
foo(count);
let t0;
if ($[0] !== posts) {
t0 = <>{posts}</>;
$[0] = posts;
$[1] = t0;
} else {
t0 = $[1];
}
return t0;
}