Files
oxc-project__oxc/crates/oxc_react_compiler/tests/snapshots/optional-call-logical.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

27 lines
575 B
Plaintext

---
source: crates/oxc_react_compiler/tests/snapshot.rs
input_file: crates/oxc_react_compiler/fixtures/optional-call-logical.js
---
import { c as _c } from "react/compiler-runtime";
import { useFragment } from "shared-runtime";
function Component(props) {
const $ = _c(2);
const item = useFragment(graphql`
fragment F on T {
id
}
`, props.item);
let t0;
if ($[0] !== item.items) {
t0 = item.items?.map(_temp) ?? [];
$[0] = item.items;
$[1] = t0;
} else {
t0 = $[1];
}
return t0;
}
function _temp(item_0) {
return renderItem(item_0);
}