ThemeProvider: Remove dangerouslySetInnerHTML under FF#7971
Conversation
🦋 Changeset detectedLatest commit: 4606ec7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
There was a problem hiding this comment.
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_handofffeature flag and defaulted it tofalse. - Updated
ThemeProviderto (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
|
Integration test results from github/github-ui PR:
All checks passed! |
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
Rollout strategy
Testing & Reviewing
Merge checklist