mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
daf03ff25d
Bail out when JSX `ref` values are loaded through properties, matching React Compiler and preserving getter and live-binding evaluation semantics. The validator previously stopped temporary tracking for every property result inferred as ref-like instead of only stopping for `ref.current`. Validation: `cargo test -p oxc_react_compiler` and `just ready`. AI assistance: Codex was used to investigate and prepare this change; the contributor remains responsible for reviewing it before merge.
20 lines
451 B
Plaintext
20 lines
451 B
Plaintext
---
|
|
source: crates/oxc_react_compiler/tests/snapshot.rs
|
|
input_file: crates/oxc_react_compiler/fixtures/allow-jsx-ref-destructured-parameter.tsx
|
|
---
|
|
import { c as _c } from "react/compiler-runtime";
|
|
// @validateRefAccessDuringRender @compilationMode:"infer"
|
|
export function Button(t0) {
|
|
const $ = _c(2);
|
|
const { ref } = t0;
|
|
let t1;
|
|
if ($[0] !== ref) {
|
|
t1 = <button ref={ref} />;
|
|
$[0] = ref;
|
|
$[1] = t1;
|
|
} else {
|
|
t1 = $[1];
|
|
}
|
|
return t1;
|
|
}
|