Skip to content

ThemeProvider: Remove dangerouslySetInnerHTML under FF - #7971

Merged
francinelucca merged 2 commits into
mainfrom
chore/remove-dangerouslysethtml-under-ff
Jun 10, 2026
Merged

ThemeProvider: Remove dangerouslySetInnerHTML under FF#7971
francinelucca merged 2 commits into
mainfrom
chore/remove-dangerouslysethtml-under-ff

Conversation

@francinelucca

Copy link
Copy Markdown
Member

Relates to https://github.com/github/primer/issues/1049

We believe this is no longer needed now that we've moved away from styled-components, removing under FF to be cautious

Changelog

New

Changed

  • Make PreventSSRMismatch a noop under FF

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

Merge checklist

CopilotAI review requested due to automatic review settings June 10, 2026 19:50
@francinelucca
francinelucca requested a review from a team as a code ownerJune 10, 2026 19:50
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4606ec7

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

This PR includes changesets to release 1 package
NameType
@primer/reactPatch

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-actionsgithub-actionsBot added the staff Author is a staff member label Jun 10, 2026
@github-actions

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. 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-actionsgithub-actionsBot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Jun 10, 2026
@francineluccafrancinelucca added the Canary Release Apply this label when you want CI to create a canary release of the current PR label Jun 10, 2026

CopilotAI 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 introduces a feature flag-controlled path in ThemeProvider to skip the SSR “handoff” <script> (and therefore avoid dangerouslySetInnerHTML) while keeping the existing SSR mismatch-prevention behavior available when the flag is off. It also adds coverage and a changeset for the patch release.

Changes:

  • Added primer_react_theme_provider_remove_ssr_handoff feature flag and defaulted it to false.
  • Updated ThemeProvider to (a) bypass server handoff color mode resolution and (b) skip rendering the SSR handoff script when the flag is enabled.
  • Added unit tests asserting the script tag is omitted/present based on the flag value, and added a patch changeset.
Show a summary per file
FileDescription
packages/react/src/ThemeProvider.tsxGates SSR handoff color mode logic + script rendering behind primer_react_theme_provider_remove_ssr_handoff.
packages/react/src/FeatureFlags/DefaultFeatureFlags.tsRegisters the new feature flag with a default value of false.
packages/react/src/tests/ThemeProvider.test.tsxAdds tests verifying SSR handoff script rendering behavior under the feature flag.
.changeset/remove-ssr-handoff-script-under-ff.mdPatch changeset documenting the flag-controlled behavior change.

Copilot's findings

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

@github-actions
github-actionsBot requested a deployment to storybook-preview-7971 June 10, 2026 19:54 Abandoned
@github-actions
github-actionsBottemporarily deployed to storybook-preview-7971 June 10, 2026 20:06 Inactive
@francinelucca
francinelucca added this pull request to the merge queueJun 10, 2026
@primer-integration

Copy link
Copy Markdown

Integration test results from github/github-ui PR:

Passed CI  Passed
Passed VRT  Passed
Passed Projects  Passed

All checks passed!

Merged via the queue into main with commit 2087e87Jun 10, 2026
61 checks passed
@francinelucca
francinelucca deleted the chore/remove-dangerouslysethtml-under-ff branch June 10, 2026 20:36
@primerprimerBot mentioned this pull request Jun 10, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Canary ReleaseApply this label when you want CI to create a canary release of the current PRintegration-tests: recommendedThis change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpmstaffAuthor is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@francinelucca@jonrohan