Skip to content

fix: correct Object.assign usage in ActionMenu, DataTable exports in @primer/styled-react#7738

Merged
francinelucca merged 5 commits intomainfrom
chore/styled-react-test
Apr 9, 2026
Merged

fix: correct Object.assign usage in ActionMenu, DataTable exports in @primer/styled-react#7738
francinelucca merged 5 commits intomainfrom
chore/styled-react-test

Conversation

@francinelucca
Copy link
Copy Markdown
Member

@francinelucca francinelucca commented Apr 9, 2026

@primer/styled-react was mutating imported @primer/react components via Object.assign, causing unintended side effects. This PR introduces wrapper components to prevent mutation, preserves __SLOT__ markers for slot-based APIs, and adds Table.__SLOT__ to @primer/react's DataTable export.

Changelog

New

  • @primer/react DataTable Table now has a __SLOT__ marker (Table.__SLOT__ = Symbol('Table')) for slot-based API compatibility

Changed

  • @primer/styled-react ActionMenu and Table: replaced direct Object.assign onto imported @primer/react components with wrapper components (ActionMenuRoot, TableRoot) — originals are no longer mutated
  • TableRoot implemented via React.forwardRef<HTMLTableElement, TableProps> to correctly forward refs to the underlying PrimerDataTable
  • __SLOT__ symbols are copied onto the wrapper components so slot matching continues to work

Removed

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

Testing & Reviewing

Both packages type-check and lint cleanly. The forwardRef wrapper matches the signature of the original PrimerDataTable (React.forwardRef<HTMLTableElement, TableProps>), so existing ref usage is unaffected.

Merge checklist

@francinelucca francinelucca added the Canary Release Apply this label when you want CI to create a canary release of the current PR label Apr 9, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 9, 2026

🦋 Changeset detected

Latest commit: a74369d

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

This PR includes changesets to release 2 packages
Name Type
@primer/styled-react Patch
@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
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

⚠️ 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. 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 Apr 9, 2026
@github-actions github-actions bot requested a deployment to storybook-preview-7738 April 9, 2026 02:58 Abandoned
@francinelucca francinelucca changed the title fix: correct Object.assign usage in ActionMenu export fix: correct Object.assign usage in ActionMenu, DataTable exports in @primer/styled-react Apr 9, 2026
@github-actions github-actions bot requested a deployment to storybook-preview-7738 April 9, 2026 03:05 Abandoned
@primer-integration
Copy link
Copy Markdown

👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/18174

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Prevents @primer/styled-react from mutating imported @primer/react components via Object.assign by introducing wrapper “root” components, and adds a __SLOT__ marker to @primer/react’s DataTable Table export to support slot-based APIs.

Changes:

  • Replace Object.assign(PrimerComponent, …) with Object.assign(WrapperRoot, …) for ActionMenu and DataTable/Table in @primer/styled-react.
  • Preserve/copy __SLOT__ markers on the styled-react wrappers to keep slot matching working.
  • Add Table.__SLOT__ to @primer/react DataTable exports and add a changeset.
Show a summary per file
File Description
packages/styled-react/src/components/DataTable.tsx Introduces TableRoot wrapper and assigns static members onto it instead of mutating the imported experimental Table.
packages/styled-react/src/components/ActionMenu.tsx Introduces ActionMenuRoot wrapper and assigns static members onto it instead of mutating the imported ActionMenu.
packages/react/src/DataTable/index.ts Adds SlotMarker typing and assigns a __SLOT__ symbol to Table.
.changeset/datatable-slot-marker.md Adds a changeset entry describing the mutation fix release.

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 2

…geset

Agent-Logs-Url: https://github.com/primer/react/sessions/7eebd40d-859e-492c-b9e3-7e91102d8a90

Co-authored-by: francinelucca <40550942+francinelucca@users.noreply.github.com>
@primer-integration
Copy link
Copy Markdown

⚠️ Integration PR Outdated

This integration PR does not have the latest commit from the primer/react PR.

Integration PR references: f63c1d2a9cd5577af26e162ecf127d03ca103c48
Latest commit on primer/react PR: a74369d51c8362a4b8dafed81cae888ef0fe74a9

Please update the integration PR to reference the latest commit from the primer/react PR before reviewing workflow results.

@francinelucca francinelucca added the integration-tests: skipped manually Changes in this PR do not require an integration test label Apr 9, 2026
@francinelucca francinelucca added this pull request to the merge queue Apr 9, 2026
Merged via the queue into main with commit f5f2869 Apr 9, 2026
61 checks passed
@francinelucca francinelucca deleted the chore/styled-react-test branch April 9, 2026 13:52
@primer primer bot mentioned this pull request Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Canary Release Apply this label when you want CI to create a canary release of the current PR integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm integration-tests: skipped manually Changes in this PR do not require an integration test staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants