diff --git a/.github/workflows/runtime_build_and_test.yml b/.github/workflows/runtime_build_and_test.yml index 92b8e2c7b8..181bb2ffa8 100644 --- a/.github/workflows/runtime_build_and_test.yml +++ b/.github/workflows/runtime_build_and_test.yml @@ -285,7 +285,7 @@ jobs: - name: Archive build artifacts uses: actions/upload-artifact@v4 with: - name: combined_artifacts_${{ github.sha }} + name: artifacts_combined path: | ./build.tgz ./build2.tgz diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/change-detect.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/change-detect.expect.md index e5dfa7a83c..ad25b51537 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/change-detect.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/change-detect.expect.md @@ -13,12 +13,18 @@ function Component(props) {
{a} {b} - {c} + {c.c} {d}
); } +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{ x: 1, y: { b: 2, c: 3, d: 4 } }], + isComponent: true, +}; + ``` ## Code @@ -29,7 +35,7 @@ import { c as _c } from "react/compiler-runtime"; // @enableChangeDetectionForDe let glob = 1; function Component(props) { - const $ = _c(11); + const $ = _c(13); let t0; { t0 = props.x; @@ -47,80 +53,102 @@ function Component(props) { } } const a = t0; - let b; let c; + let b; { ({ b, ...c } = props.y); let condition = $[2] !== props.y; if (!condition) { - let old$b = $[3]; - let old$c = $[4]; - $structuralCheck(old$b, b, "b", "Component", "cached", "(6:6)"); + let old$c = $[3]; + let old$b = $[4]; $structuralCheck(old$c, c, "c", "Component", "cached", "(6:6)"); + $structuralCheck(old$b, b, "b", "Component", "cached", "(6:6)"); } $[2] = props.y; - $[3] = b; - $[4] = c; + $[3] = c; + $[4] = b; if (condition) { ({ b, ...c } = props.y); - $structuralCheck($[3], b, "b", "Component", "recomputed", "(6:6)"); - b = $[3]; - $structuralCheck($[4], c, "c", "Component", "recomputed", "(6:6)"); - c = $[4]; + $structuralCheck($[3], c, "c", "Component", "recomputed", "(6:6)"); + c = $[3]; + $structuralCheck($[4], b, "b", "Component", "recomputed", "(6:6)"); + b = $[4]; } } let t1; { - t1 = glob; - let condition = $[5] === Symbol.for("react.memo_cache_sentinel"); + t1 = c.c; + let condition = $[5] !== c.c; if (!condition) { - let old$t1 = $[5]; - $structuralCheck(old$t1, t1, "t1", "Component", "cached", "(13:13)"); + let old$t1 = $[6]; + $structuralCheck(old$t1, t1, "t1", "Component", "cached", "(12:12)"); } - $[5] = t1; + $[5] = c.c; + $[6] = t1; if (condition) { - t1 = glob; - $structuralCheck($[5], t1, "t1", "Component", "recomputed", "(13:13)"); - t1 = $[5]; + t1 = c.c; + $structuralCheck($[6], t1, "t1", "Component", "recomputed", "(12:12)"); + t1 = $[6]; } } let t2; { - t2 = ( + t2 = glob; + let condition = $[7] === Symbol.for("react.memo_cache_sentinel"); + if (!condition) { + let old$t2 = $[7]; + $structuralCheck(old$t2, t2, "t2", "Component", "cached", "(13:13)"); + } + $[7] = t2; + if (condition) { + t2 = glob; + $structuralCheck($[7], t2, "t2", "Component", "recomputed", "(13:13)"); + t2 = $[7]; + } + } + let t3; + { + t3 = (
{a} {b} - {c} {t1} + {t2}
); - let condition = $[6] !== a || $[7] !== b || $[8] !== c || $[9] !== t1; + let condition = $[8] !== a || $[9] !== b || $[10] !== t1 || $[11] !== t2; if (!condition) { - let old$t2 = $[10]; - $structuralCheck(old$t2, t2, "t2", "Component", "cached", "(9:14)"); + let old$t3 = $[12]; + $structuralCheck(old$t3, t3, "t3", "Component", "cached", "(9:14)"); } - $[6] = a; - $[7] = b; - $[8] = c; - $[9] = t1; - $[10] = t2; + $[8] = a; + $[9] = b; + $[10] = t1; + $[11] = t2; + $[12] = t3; if (condition) { - t2 = ( + t3 = (
{a} {b} - {c} {t1} + {t2}
); - $structuralCheck($[10], t2, "t2", "Component", "recomputed", "(9:14)"); - t2 = $[10]; + $structuralCheck($[12], t3, "t3", "Component", "recomputed", "(9:14)"); + t3 = $[12]; } } - return t2; + return t3; } +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{ x: 1, y: { b: 2, c: 3, d: 4 } }], + isComponent: true, +}; + ``` ### Eval output -(kind: exception) Fixture not implemented \ No newline at end of file +(kind: ok)
1231
\ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/change-detect.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/change-detect.js index a08de6c747..02a391613c 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/change-detect.js +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/change-detect.js @@ -9,8 +9,14 @@ function Component(props) {
{a} {b} - {c} + {c.c} {d}
); } + +export const FIXTURE_ENTRYPOINT = { + fn: Component, + params: [{ x: 1, y: { b: 2, c: 3, d: 4 } }], + isComponent: true, +};