Skip to content

Conversation

@dmytrokirpa
Copy link
Contributor

@dmytrokirpa dmytrokirpa commented Feb 3, 2026

Previous Behavior

Multiple Fluent UI v9 packages were missing the 'use client' directive in their compiled JavaScript output, causing React Server Components (RSC) compatibility issues. Components that use client-side APIs (hooks, DOM manipulation, browser APIs) were being treated as server components by default, leading to runtime errors when developers tried to use them in RSC environments.

Affected packages included:

  • @fluentui/react-text - Text preset components and style hooks
  • @fluentui/react-utilities - Client-side hooks like useIsomorphicLayoutEffect
  • @fluentui/react-shared-contexts - Context files requiring client-side rendering
  • @fluentui/react-message-bar
  • @fluentui/react-motion-components-preview
  • Various utility files using getWindow() and other browser APIs

New Behavior

All client-side components, hooks, and utilities now include the 'use client' directive in their source files. This ensures that:

  • Components are properly marked for client-side rendering in RSC environments
  • Developers can import and use Fluent UI v9 components directly in Next.js App Router and other RSC frameworks
  • The build output correctly propagates the directive to consumers

Files updated include:

  • Component style files and hooks that access browser APIs
  • React migration library components (v0-v9 and v8-v9)
  • Utility files like getWindow that require client-side execution
  • Context providers and custom hooks

Related Issue(s)

- Added "use client" directive to global-context-selector.ts, useDisableBodyScroll.styles.ts, and multiple Attachment component styles.
- Updated various components in react-migration-v0-v9 and react-migration-v8-v9 libraries to include "use client" for compatibility with client-side rendering.
- Included "use client" in utility hooks and context files to ensure proper execution in client environments.
- Adjusted imports and ensured consistent application of the directive across all affected files.
@dmytrokirpa dmytrokirpa self-assigned this Feb 3, 2026
@dmytrokirpa dmytrokirpa added Area: SSR Server-side rendering React 19 labels Feb 3, 2026
@github-actions
Copy link

github-actions bot commented Feb 3, 2026

📊 Bundle size report

✅ No changes found

@github-actions
Copy link

github-actions bot commented Feb 3, 2026

Pull request demo site: URL

@@ -0,0 +1,25 @@
{
Copy link

@github-actions github-actions bot Feb 3, 2026

Choose a reason for hiding this comment

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

🕵🏾‍♀️ visual changes to review in the Visual Change Report

vr-tests-react-components/Positioning 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Positioning.Positioning end.chromium.png 17 Changed
vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png 29 Changed
vr-tests-react-components/TagPicker 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/TagPicker.disabled - Dark Mode.chromium.png 658 Changed
vr-tests-react-components/TagPicker.disabled - High Contrast.disabled input hover.chromium.png 1319 Changed
vr-tests-web-components/Accordion 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-web-components/Accordion. - Dark Mode.normal.chromium_1.png 3154 Changed
vr-tests-web-components/Avatar 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-web-components/Avatar. - Dark Mode.normal.chromium.png 10380 Changed
vr-tests-web-components/MenuList 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-web-components/MenuList. - RTL.2nd selected.chromium.png 17 Changed
vr-tests-web-components/RadioGroup 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-web-components/RadioGroup. - Dark Mode.normal.chromium_1.png 89 Changed
vr-tests/Callout 9 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests/Callout.Bottom auto edge.default.chromium.png 2195 Changed
vr-tests/Callout.Bottom center.default.chromium.png 2128 Changed
vr-tests/Callout.Gap space 25.default.chromium.png 2195 Changed
vr-tests/Callout.Left center.default.chromium.png 2584 Changed
vr-tests/Callout.Bottom left edge - RTL.default.chromium.png 2199 Changed
vr-tests/Callout.Rendering callout attached to a rectangle.default.chromium.png 1835 Changed
vr-tests/Callout.Right bottom edge.default.chromium.png 3095 Changed
vr-tests/Callout.Top auto edge.default.chromium.png 2212 Changed
vr-tests/Callout.Top center.default.chromium.png 2127 Changed
vr-tests/Coachmark 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests/Coachmark.Collapsed.default.chromium.png 159 Changed
vr-tests/Keytip 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests/Keytip.Disabled.default.chromium.png 26 Changed
vr-tests/Keytip.Root.default.chromium.png 55 Changed
vr-tests/react-charting-LineChart 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests/react-charting-LineChart.Events - RTL.default.chromium.png 15 Changed
vr-tests/react-charting-LineChart.Events.default.chromium.png 17 Changed
vr-tests/react-charting-MultiStackBarChart 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests/react-charting-MultiStackBarChart.Basic_PartToWhole.default.chromium.png 359 Changed
vr-tests/react-charting-MultiStackBarChart.Basic_Absolute.default.chromium.png 359 Changed

There were 3 duplicate changes discarded. Check the build logs for more information.

@dmytrokirpa dmytrokirpa marked this pull request as ready for review February 4, 2026 11:06
@tudorpopams tudorpopams requested a review from Hotell February 4, 2026 13:09
@@ -0,0 +1,25 @@
{
"permissions": {
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be reverted ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah sorry, reverting

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, we should consider adding that to gitignores (specifically for settings.local)

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

Labels

Area: SSR Server-side rendering React 19

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Missing 'use client' directive in compiled output breaks RSC

4 participants