Skip to content

refactor: update static computed properties to static, move to experimental react compiler#8143

Open
joshblack wants to merge 8 commits into
mainfrom
copilot/react-compiler/primitives
Open

refactor: update static computed properties to static, move to experimental react compiler#8143
joshblack wants to merge 8 commits into
mainfrom
copilot/react-compiler/primitives

Conversation

@joshblack

@joshblack joshblack commented Jul 9, 2026

Copy link
Copy Markdown
Member

Closes #

This PR updates our React Compiler packages to the current experimental build so the local migration check matches the compiler behavior in the playground more closely.

With the newer compiler, dynamic template-literal object keys compile without the source rewrites we were adding before. As a result, this PR keeps the source changes focused on computed object-pattern destructuring that still fails the compiler check.

Changelog

New

  • Add a changeset for the @primer/react React Compiler runtime dependency update.

Changed

  • Update babel-plugin-react-compiler across the repo to 0.0.0-experimental-a1856f3-20260507.
  • Update react-compiler-runtime in @primer/react and @primer/styled-react to 0.0.0-experimental-a1856f3-20260507.
  • Replace computed object-pattern destructuring in the remaining failing files with static property destructuring.
  • Remove React Compiler diagnostic filtering from @primer/react-compiler-check so compile errors are surfaced directly.

Removed

  • Remove the workaround-style rewrites for dynamic template-literal object keys since the experimental compiler handles those cases.

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

This should be a patch: it updates internal compiler tooling and the published compiler runtime dependency, without changing the public component API.

Testing & Reviewing

Verified the compiler migration path and focused package checks:

  • npm run lint:react-compiler -w @primer/react
  • npx vitest run packages/react-compiler-check/src/index.test.ts
  • npm run type-check -w @primer/react-compiler-check
  • npm run type-check -w @primer/react
  • npm run type-check -w @primer/styled-react

@changeset-bot

changeset-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4473727

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the staff Author is a staff member label Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. If this doesn't work, you can also use the original workflow here. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

To publish a canary release for integration testing, apply the Canary Release label to this PR.

@github-actions github-actions Bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Jul 9, 2026
@github-actions github-actions Bot temporarily deployed to storybook-preview-8143 July 9, 2026 14:47 Inactive
@github-actions github-actions Bot temporarily deployed to storybook-preview-8143 July 9, 2026 15:28 Inactive
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 47294113-3de3-46e1-a6e8-f3360cf91de4
@joshblack joshblack force-pushed the copilot/react-compiler/primitives branch from ac3063e to 860feda Compare July 9, 2026 16:22
@joshblack joshblack changed the title Enable React Compiler for shared primitives Ignore static computed React Compiler diagnostics Jul 9, 2026
@github-actions github-actions Bot temporarily deployed to storybook-preview-8143 July 9, 2026 16:33 Inactive
Replace static computed property syntax with static property names so React Compiler diagnostics are surfaced instead of ignored.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 56b531f4-215a-46cc-a593-543687336648
joshblack added 2 commits July 9, 2026 12:45
Limit the React Compiler static-property cleanup to static computed property cases and keep the existing dynamic template-literal diagnostic handling.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 56b531f4-215a-46cc-a593-543687336648
Convert the remaining computed object keys that failed the check to static property names so all compiler diagnostics are surfaced.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 56b531f4-215a-46cc-a593-543687336648
@github-actions github-actions Bot requested a deployment to storybook-preview-8143 July 9, 2026 17:52 Abandoned
Move the longer static data attribute and class mappings into helpers so the React Compiler fixes stay readable.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 56b531f4-215a-46cc-a593-543687336648
Keep the compiler-check test file unchanged while preserving the source fixes for surfaced compiler diagnostics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 56b531f4-215a-46cc-a593-543687336648
joshblack added 2 commits July 9, 2026 15:06
Update React Compiler and runtime packages to the current experimental build and drop source rewrites that are no longer needed with that compiler. Keep the object-pattern destructuring fixes and make compiler error handling robust across compiler builds.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 56b531f4-215a-46cc-a593-543687336648
The experimental React Compiler package now resolves consistently, so the existing CompilerError instanceof check is sufficient.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 56b531f4-215a-46cc-a593-543687336648
@github-actions github-actions Bot requested a deployment to storybook-preview-8143 July 9, 2026 20:15 Abandoned
@joshblack joshblack changed the title Ignore static computed React Compiler diagnostics Use experimental React Compiler packages Jul 9, 2026
@joshblack joshblack changed the title Use experimental React Compiler packages refactor: update static computed properties to static, move to experimental react compiler Jul 9, 2026
@joshblack joshblack marked this pull request as ready for review July 9, 2026 20:26
@joshblack joshblack requested a review from a team as a code owner July 9, 2026 20:26
@joshblack joshblack requested review from Copilot and siddharthkp July 9, 2026 20:26
@primer-integration

primer-integration Bot commented Jul 9, 2026

Copy link
Copy Markdown

Integration test results from github/github-ui PR:

Passed  CI   Passed
Waiting  VRT   Waiting
Running  Projects   Running

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the repo’s React Compiler toolchain to a newer experimental build (to better match compiler behavior in the playground) and adjusts a handful of call sites to avoid computed-property destructuring patterns that still fail compiler checks. It also adds a changeset to capture the published @primer/react runtime dependency bump.

Changes:

  • Bump babel-plugin-react-compiler across the repo and bump react-compiler-runtime for @primer/react (and devDependency usage in @primer/styled-react) to 0.0.0-experimental-a1856f3-20260507.
  • Replace computed-key object destructuring (e.g. {['aria-label']: x}) with static string-literal destructuring (e.g. {'aria-label': x}) in the remaining affected files.
  • Add a changeset for the @primer/react runtime dependency update and update the lockfile accordingly.
Show a summary per file
File Description
packages/styled-react/package.json Bumps compiler plugin + runtime devDependency to the experimental build for the styled-react workspace.
packages/react/src/CounterLabel/CounterLabel.tsx Converts data-component prop destructuring to static string-literal destructuring.
packages/react/src/Checkbox/Checkbox.tsx Converts data-component prop destructuring to static string-literal destructuring.
packages/react/src/Button/ButtonBase.tsx Converts aria-* prop destructuring to static string-literal destructuring.
packages/react/src/Autocomplete/Autocomplete.test.tsx Converts aria-labelledby destructuring to static string-literal destructuring.
packages/react/src/ActionBar/ActionBar.tsx Converts aria-label destructuring to static string-literal destructuring.
packages/react/package.json Bumps react-compiler-runtime dependency and compiler plugin devDependency to the experimental build.
packages/react-compiler-check/package.json Bumps compiler plugin dependency to the experimental build for the check package.
package.json Bumps root babel-plugin-react-compiler devDependency to the experimental build.
package-lock.json Updates the lockfile to reflect the dependency/version changes (plus some additional transitive bumps).
.changeset/react-compiler-experimental-runtime.md Adds a patch changeset for @primer/react runtime dependency update.

Review details

  • Files reviewed: 10/11 changed files
  • Comments generated: 0
  • Review effort level: Low

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants