Skip to content

Conversation

@levithomason
Copy link
Member

@levithomason levithomason commented May 31, 2022

This PR removes the useTheme export as it is no longer needed. If you need access to design tokens, import them directly:

import { tokens } from '@fluentui/react-components'

@levithomason levithomason requested a review from a team as a code owner May 31, 2022 15:56
Pick<FluentProviderProps, 'targetDocument'> &
Required<Pick<FluentProviderProps, 'dir'>> & {
theme: Theme | Partial<Theme> | undefined;
theme: ThemeContextValue;
Copy link
Member Author

Choose a reason for hiding this comment

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

There were 5 or 6 instances of this specific typing, so I extracted it.

Copy link
Member

Choose a reason for hiding this comment

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

Is this related to the useTheme change?

@fabricteam
Copy link
Collaborator

fabricteam commented May 31, 2022

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
181.029 kB
50.535 kB
181.023 kB
50.536 kB
-6 B
1 B
react-components
react-components: FluentProvider & webLightTheme
33.95 kB
11.044 kB
33.944 kB
11.043 kB
-6 B
-1 B
react-provider
FluentProvider
13.999 kB
5.249 kB
13.993 kB
5.248 kB
-6 B
-1 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-accordion
Accordion (including children components)
74.036 kB
22.588 kB
react-avatar
Avatar
45.454 kB
13.251 kB
react-button
Button
32.846 kB
8.967 kB
react-button
CompoundButton
39.753 kB
10.198 kB
react-button
MenuButton
35.018 kB
9.724 kB
react-button
SplitButton
42.259 kB
11.018 kB
react-button
ToggleButton
47.329 kB
10.513 kB
react-card
Card - All
61.928 kB
17.65 kB
react-card
Card
57.213 kB
16.465 kB
react-card
CardFooter
7.737 kB
3.266 kB
react-card
CardHeader
9.302 kB
3.776 kB
react-card
CardPreview
7.709 kB
3.287 kB
react-combobox
Combobox
61.243 kB
20.906 kB
react-link
Link
11.358 kB
4.58 kB
react-menu
Menu (including children components)
111.457 kB
33.972 kB
react-menu
Menu (including selectable components)
114.632 kB
34.44 kB
react-popover
Popover
103.59 kB
31.473 kB
react-portal
Portal
6.272 kB
2.17 kB
react-positioning
usePositioning
23.828 kB
8.283 kB
react-radio
Radio
29.397 kB
10.043 kB
react-radio
RadioGroup
13.595 kB
5.42 kB
react-slider
Slider
25.156 kB
8.113 kB
react-switch
Switch
25.37 kB
8.201 kB
react-tooltip
Tooltip
43.503 kB
14.968 kB
🤖 This report was generated against 287cf6769bda0ca0ec7cd29b01a4a4481a488d92

@size-auditor
Copy link

size-auditor bot commented May 31, 2022

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: 287cf6769bda0ca0ec7cd29b01a4a4481a488d92 (build)

Copy link
Member

@miroslavstastny miroslavstastny left a comment

Choose a reason for hiding this comment

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

We should go with #23325 instead.

@levithomason
Copy link
Member Author

I think this PR is different than #23325. This PR removes the export entirely since it is no longer required due to global context and the ability to import tokens.

The other PR leaves this export but just renames it to "unstable". I think we should merge this one first, then #23325.

@miroslavstastny miroslavstastny self-requested a review May 31, 2022 16:51
@spmonahan
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 31, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 6ad5978:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@@ -1,4 +1,5 @@
export { ThemeContext, useTheme } from './ThemeContext';
export { ThemeContext } from './ThemeContext';
export type { ThemeContextValue } from './ThemeContext';
Copy link
Member

Choose a reason for hiding this comment

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

in #23325 we are moving react-shared-contexts to unstable. Does this have any effect on exporting this type from the unstable package?

@fabricteam
Copy link
Collaborator

Perf Analysis (@fluentui/react-components)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 1225 1219 5000
Button mount 767 737 5000
FluentProvider mount 2231 2219 5000
FluentProviderWithTheme mount 388 393 10
FluentProviderWithTheme virtual-rerender 355 359 10
FluentProviderWithTheme virtual-rerender-with-unmount 422 405 10
MakeStyles mount 2024 1985 50000

@miroslavstastny miroslavstastny dismissed their stale review May 31, 2022 18:06

discussed offline

@spmonahan spmonahan merged commit 4ed24c2 into microsoft:master May 31, 2022
@levithomason levithomason deleted the feat/remove-use-theme branch May 31, 2022 20:51
marwan38 pushed a commit to marwan38/fluentui that referenced this pull request Jun 13, 2022
* remove useTheme from exports

* run yarn change

* fix bad merge

* fix type export

* remove export useTheme

* update react-provider change json

* update react-provider api snapshot

Co-authored-by: Sean Monahan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants