fix: add missing "use client" directive to client components and styles#35719
Merged
Hotell merged 11 commits intomicrosoft:masterfrom Feb 12, 2026
Merged
fix: add missing "use client" directive to client components and styles#35719Hotell merged 11 commits intomicrosoft:masterfrom
Hotell merged 11 commits intomicrosoft:masterfrom
Conversation
- 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.
📊 Bundle size report✅ No changes found |
|
Pull request demo site: URL |
Hotell
reviewed
Feb 4, 2026
AtishayMsft
approved these changes
Feb 4, 2026
Hotell
approved these changes
Feb 4, 2026
Contributor
Hotell
left a comment
There was a problem hiding this comment.
left some comments where some need action, overall LGTM, ty
packages/react-components/eslint-plugin-react-components/src/rules/enforce-use-client.spec.ts
Outdated
Show resolved
Hide resolved
| /** | ||
| * Track imported custom hooks and RSC-unsface functions | ||
| */ | ||
| ImportDeclaration(node: TSESTree.ImportDeclaration) { |
Contributor
There was a problem hiding this comment.
can we merge this with Identifier visitor logic ? as we are already checking if its coming from import
packages/react-components/eslint-plugin-react-components/src/rules/enforce-use-client.ts
Outdated
Show resolved
Hide resolved
packages/react-components/eslint-plugin-react-components/src/rules/enforce-use-client.spec.ts
Outdated
Show resolved
Hide resolved
packages/react-components/eslint-plugin-react-components/src/rules/enforce-use-client.spec.ts
Outdated
Show resolved
Hide resolved
packages/react-components/eslint-plugin-react-components/src/rules/enforce-use-client.ts
Outdated
Show resolved
Hide resolved
layershifter
approved these changes
Feb 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 likeuseIsomorphicLayoutEffect@fluentui/react-shared-contexts- Context files requiring client-side rendering@fluentui/react-message-bar@fluentui/react-motion-components-previewgetWindow()and other browser APIsNew Behavior
All client-side components, hooks, and utilities now include the
'use client'directive in their source files. This ensures that:Files updated include:
getWindowthat require client-side executionRelated Issue(s)