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

Copilot AI review requested due to automatic review settings June 10, 2026 19:50
@francinelucca francinelucca requested a review from a team as a code owner June 10, 2026 19:50
@francinelucca francinelucca requested a review from jonrohan June 10, 2026 19:50
@changeset-bot

changeset-bot Bot commented Jun 10, 2026

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
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 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-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 Jun 10, 2026
@francinelucca francinelucca added the Canary Release Apply this label when you want CI to create a canary release of the current PR label Jun 10, 2026

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 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
File Description
packages/react/src/ThemeProvider.tsx Gates SSR handoff color mode logic + script rendering behind primer_react_theme_provider_remove_ssr_handoff.
packages/react/src/FeatureFlags/DefaultFeatureFlags.ts Registers the new feature flag with a default value of false.
packages/react/src/tests/ThemeProvider.test.tsx Adds tests verifying SSR handoff script rendering behavior under the feature flag.
.changeset/remove-ssr-handoff-script-under-ff.md Patch changeset documenting the flag-controlled behavior change.

Copilot's findings

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

@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 2087e87 Jun 10, 2026
61 checks passed
@francinelucca francinelucca deleted the chore/remove-dangerouslysethtml-under-ff branch June 10, 2026 20:36
@primer primer Bot mentioned this pull request Jun 10, 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 staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants