Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TESTING ONLY - update to React 17 #22326

Closed
wants to merge 5 commits into from

Conversation

ecraig12345
Copy link
Member

@ecraig12345 ecraig12345 commented Apr 5, 2022

Draft of updating to React 17 with community enzyme adapter.

Status as of Monday April 11

I'm "officially" dropping this now (probably). This PR currently contains the changes in #22438 + the actual upgrade.

After updating the types (which I hadn't done before), some additional issues show up that will be tricky to deal with. The immediate one is that the latest @types/react@17 references Iterable, which is only in es2015.iterable and up and therefore won't work in v8 packages that only use es5.

See the PR comments for info about other notable changes you may want to want to include in the final version.

Also note that after doing the update properly (not with resolutions), there are still a few things that pull in React 16:

  • @fluentui/web-components => @storybook/html => react, react-dom (shouldn't matter)
  • @fluentui/vr-tests => screener-storybook => react, react-dom (might matter, needs investigation)

And a bunch of things pull in react-is 16, but that may be less of an issue.

Related issue

#20145

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 5, 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 5d7c747:

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

@DustyTheBot
Copy link

Fails
🚫

Non-approved dependencies were detected. It is necessary to obtain approvals and register them in the approvedPackages file before merge.

Warnings
⚠️ There are no updates provided to CHANGELOG. Ensure there are no publicly visible changes introduced by this PR.

Non-approved dependencies are detected.

The following package version constraints are missing an approved candidate:

failed constraints approved candidates
react@17.0.2 react@16.8.3, react@16.14.0
react-is@^16.13.1 react-is@16.8.2, react-is@16.9.0
scheduler@^0.20.2 scheduler@0.13.3, scheduler@0.13.6, scheduler@0.19.1

Generated by 🚫 dangerJS against d94d336

@size-auditor
Copy link

size-auditor bot commented Apr 5, 2022

Asset size changes

Project Bundle Baseline Size New Size Difference
office-ui-fabric-react fluentui-react-northstar-Debug 10.761 kB 10.887 kB ExceedsBaseline     126 bytes
office-ui-fabric-react fluentui-react-northstar-Accordion 97.417 kB 97.508 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Image 84.628 kB 84.719 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-ItemLayout 89.576 kB 89.667 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Label 89.276 kB 89.367 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Layout 86.575 kB 86.666 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Loader 89.977 kB 90.068 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Pill 95.204 kB 95.295 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Popup 146.948 kB 147.039 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Portal 59.163 kB 59.254 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-RadioGroup 95.141 kB 95.232 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Reaction 88.653 kB 88.744 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Skeleton 88.934 kB 89.025 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Slider 96.076 kB 96.167 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Status 87.648 kB 87.739 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Table 92.534 kB 92.625 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Text 85.231 kB 85.322 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-TextArea 85.36 kB 85.451 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Tooltip 120.766 kB 120.857 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Tree 101.527 kB 101.618 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Video 86.525 kB 86.616 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Input 100.07 kB 100.161 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Segment 87.46 kB 87.551 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Header 85.924 kB 86.015 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Checkbox 91.569 kB 91.66 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Alert 99.54 kB 99.631 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Attachment 98.788 kB 98.879 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Avatar 90.879 kB 90.97 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Box 86.439 kB 86.53 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Button 94.827 kB 94.918 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Card 94.262 kB 94.353 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Carousel 118.439 kB 118.53 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Breadcrumb 91.288 kB 91.379 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Datepicker 202.122 kB 202.213 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Dialog 124.691 kB 124.782 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Embed 93.108 kB 93.199 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Divider 87.879 kB 87.97 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Form 104.499 kB 104.59 kB ExceedsBaseline     91 bytes
office-ui-fabric-react fluentui-react-northstar-Animation 57.337 kB 57.427 kB ExceedsBaseline     90 bytes
office-ui-fabric-react fluentui-react-northstar-Design 36.73 kB 36.739 kB ExceedsBaseline     9 bytes
office-ui-fabric-react fluentui-react-northstar-Provider 93.755 kB 93.764 kB ExceedsBaseline     9 bytes
office-ui-fabric-react fluentui-react-northstar-Flex 48.636 kB 48.645 kB ExceedsBaseline     9 bytes
office-ui-fabric-react fluentui-react-northstar-Grid 81.447 kB 81.456 kB ExceedsBaseline     9 bytes
office-ui-fabric-react fluentui-react-northstar-Toolbar 189.647 kB 189.525 kB BelowBaseline     -122 bytes
office-ui-fabric-react fluentui-react-northstar-Chat 166.459 kB 166.337 kB BelowBaseline     -122 bytes
office-ui-fabric-react fluentui-react-northstar-Menu 141.699 kB 141.577 kB BelowBaseline     -122 bytes
office-ui-fabric-react fluentui-react-northstar-MenuButton 177.131 kB 177.009 kB BelowBaseline     -122 bytes
office-ui-fabric-react fluentui-react-northstar-Dropdown 212.456 kB 212.334 kB BelowBaseline     -122 bytes
office-ui-fabric-react fluentui-react-northstar-SplitButton 193.399 kB 193.277 kB BelowBaseline     -122 bytes
office-ui-fabric-react fluentui-react-northstar-List 100.991 kB 100.869 kB BelowBaseline     -122 bytes

ExceedsTolerance Over Tolerance (1024 B) ExceedsBaseline Over Baseline BelowBaseline Below Baseline New New Deleted  Removed 1 kB = 1000 B

Baseline commit: 126d1921f2a886bbb96fd1e94d542255024c91b7 (build)

@fabricteam
Copy link
Collaborator

fabricteam commented Apr 5, 2022

Perf Analysis (@fluentui/react-components)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 1069 1130 5000
Button mount 640 620 5000
FluentProvider mount 2110 2094 5000
FluentProviderWithTheme mount 317 321 10
FluentProviderWithTheme virtual-rerender 257 251 10
FluentProviderWithTheme virtual-rerender-with-unmount 344 341 10
MakeStyles mount 1903 1796 50000

@fabricteam
Copy link
Collaborator

fabricteam commented Apr 5, 2022

Perf Analysis (@fluentui/react-northstar)

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
TooltipMinimalPerf.default 2419 1183 2.04:1
RosterPerf.default 2340 1232 1.9:1
IconMinimalPerf.default 701 622 1.13:1
TreeWith60ListItems.default 188 167 1.13:1
VideoMinimalPerf.default 803 718 1.12:1
ButtonMinimalPerf.default 192 173 1.11:1
RefMinimalPerf.default 239 221 1.08:1
AlertMinimalPerf.default 306 285 1.07:1
AttachmentSlotsPerf.default 1216 1148 1.06:1
AvatarMinimalPerf.default 204 193 1.06:1
SkeletonMinimalPerf.default 375 355 1.06:1
CustomToolbarPrototype.default 2977 2818 1.06:1
LoaderMinimalPerf.default 737 703 1.05:1
PortalMinimalPerf.default 170 162 1.05:1
AttachmentMinimalPerf.default 169 162 1.04:1
ButtonSlotsPerf.default 607 586 1.04:1
ChatDuplicateMessagesPerf.default 316 305 1.04:1
DropdownManyItemsPerf.default 751 730 1.03:1
HeaderMinimalPerf.default 381 371 1.03:1
LayoutMinimalPerf.default 380 369 1.03:1
PopupMinimalPerf.default 643 624 1.03:1
ReactionMinimalPerf.default 405 393 1.03:1
SegmentMinimalPerf.default 367 358 1.03:1
SplitButtonMinimalPerf.default 4821 4703 1.03:1
BoxMinimalPerf.default 359 351 1.02:1
ChatWithPopoverPerf.default 402 393 1.02:1
MenuMinimalPerf.default 910 890 1.02:1
StatusMinimalPerf.default 737 723 1.02:1
DropdownMinimalPerf.default 3118 3097 1.01:1
GridMinimalPerf.default 367 362 1.01:1
HeaderSlotsPerf.default 822 816 1.01:1
ImageMinimalPerf.default 424 419 1.01:1
ItemLayoutMinimalPerf.default 1301 1290 1.01:1
ProviderMergeThemesPerf.default 1271 1261 1.01:1
RadioGroupMinimalPerf.default 485 481 1.01:1
TableManyItemsPerf.default 2115 2103 1.01:1
ButtonOverridesMissPerf.default 1569 1575 1:1
DatepickerMinimalPerf.default 5995 6021 1:1
DialogMinimalPerf.default 807 809 1:1
FlexMinimalPerf.default 293 293 1:1
InputMinimalPerf.default 1386 1391 1:1
ListMinimalPerf.default 534 533 1:1
ListNestedPerf.default 594 594 1:1
ListWith60ListItems.default 698 695 1:1
MenuButtonMinimalPerf.default 1829 1828 1:1
ProviderMinimalPerf.default 399 398 1:1
CarouselMinimalPerf.default 478 484 0.99:1
CheckboxMinimalPerf.default 2796 2823 0.99:1
AnimationMinimalPerf.default 550 559 0.98:1
CardMinimalPerf.default 608 618 0.98:1
ChatMinimalPerf.default 806 826 0.98:1
DividerMinimalPerf.default 372 380 0.98:1
EmbedMinimalPerf.default 4354 4436 0.98:1
TableMinimalPerf.default 426 434 0.98:1
ToolbarMinimalPerf.default 996 1020 0.98:1
TreeMinimalPerf.default 846 866 0.98:1
TextMinimalPerf.default 356 368 0.97:1
TextAreaMinimalPerf.default 548 564 0.97:1
ListCommonPerf.default 667 692 0.96:1
SliderMinimalPerf.default 1738 1811 0.96:1
LabelMinimalPerf.default 396 416 0.95:1
AccordionMinimalPerf.default 150 161 0.93:1
FormMinimalPerf.default 407 466 0.87:1

@fabricteam
Copy link
Collaborator

fabricteam commented Apr 5, 2022

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-priority-overflow
hooks only
10.606 kB
4.087 kB
10.393 kB
4.02 kB
-213 B
-67 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
priority-overflow
createOverflowManager
2.836 kB
1.209 kB
react-avatar
Avatar
45.142 kB
13.111 kB
react-badge
Badge
20.895 kB
6.567 kB
react-badge
CounterBadge
21.848 kB
6.883 kB
react-badge
PresenceBadge
21.951 kB
6.565 kB
react-divider
Divider
15.385 kB
5.539 kB
react-image
Image
10.109 kB
3.958 kB
react-input
Input
21.661 kB
7.18 kB
react-label
Label
8.371 kB
3.504 kB
react-portal
Portal
6.272 kB
2.17 kB
react-positioning
usePopper
23.21 kB
8.084 kB
react-select
Select
16.562 kB
6.264 kB
react-spinbutton
SpinButton
41.512 kB
11.912 kB
react-spinner
Spinner
16.459 kB
5.549 kB
react-text
Text - Default
10.797 kB
4.233 kB
react-text
Text - Wrappers
14.113 kB
4.576 kB
react-textarea
Textarea
20.602 kB
7.033 kB
react-theme
Single theme token import
69 B
89 B
react-theme
Teams: all themes
29.676 kB
6.604 kB
react-theme
Teams: Light theme
18.492 kB
5.296 kB
react-utilities
SSRProvider
189 B
161 B
🤖 This report was generated against 72fa867ab6b084656b53c8f644df74b31077ae15

@fabricteam
Copy link
Collaborator

fabricteam commented Apr 5, 2022

Perf Analysis (@fluentui/react)

Scenario Render type Master Ticks PR Ticks Iterations Status
Layer mount 3070 4226 5000 Possible regression
All results

Scenario Render type Master Ticks PR Ticks Iterations Status
BaseButton mount 919 940 5000
Breadcrumb mount 2892 2902 1000
Checkbox mount 1568 1656 5000
CheckboxBase mount 1336 1290 5000
ChoiceGroup mount 4854 4794 5000
ComboBox mount 994 1003 1000
CommandBar mount 10829 11049 1000
ContextualMenu mount 12034 12396 1000
DefaultButton mount 1230 1105 5000
DetailsRow mount 3954 4018 5000
DetailsRowFast mount 3877 3951 5000
DetailsRowNoStyles mount 3888 3740 5000
Dialog mount 2316 2505 1000
DocumentCardTitle mount 175 160 1000
Dropdown mount 3357 3313 5000
FocusTrapZone mount 1994 1781 5000
FocusZone mount 1991 1904 5000
IconButton mount 1797 1845 5000
Label mount 372 334 5000
Layer mount 3070 4226 5000 Possible regression
Link mount 473 511 5000
MenuButton mount 1542 1492 5000
MessageBar mount 2300 2182 5000
Nav mount 3397 3391 1000
OverflowSet mount 1125 1171 5000
Panel mount 2244 2571 1000
Persona mount 1047 1013 1000
Pivot mount 1539 1449 1000
PrimaryButton mount 1315 1359 5000
Rating mount 8019 7775 5000
SearchBox mount 1315 1273 5000
Shimmer mount 2624 2966 5000
Slider mount 2019 2035 5000
SpinButton mount 5192 5089 5000
Spinner mount 471 458 5000
SplitButton mount 3596 3406 5000
Stack mount 526 546 5000
StackWithIntrinsicChildren mount 2356 2421 5000
StackWithTextChildren mount 5539 5350 5000
SwatchColorPicker mount 11910 12203 5000
TagPicker mount 2802 2761 5000
TeachingBubble mount 96904 102926 5000
Text mount 489 429 5000
TextField mount 1480 1457 5000
ThemeProvider mount 1241 1202 5000
ThemeProvider virtual-rerender 690 677 5000
ThemeProvider virtual-rerender-with-unmount 1957 2040 5000
Toggle mount 832 789 5000
buttonNative mount 140 136 5000

@ecraig12345 ecraig12345 force-pushed the react-17 branch 2 times, most recently from f236b47 to ce44315 Compare April 7, 2022 00:54
Comment on lines +247 to +250
// this gives an error:
// NotFoundError: The node to be removed is not a child of this node.
// ReactDOM.unmountComponentAtNode(attachTo);
// document.body.removeChild(attachTo);
Copy link
Member Author

Choose a reason for hiding this comment

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

This may be a real issue, not sure

- script: |
yarn check:installed-dependencies-versions
displayName: 'check packages: installed dependencies versions'
# - script: |
Copy link
Member Author

Choose a reason for hiding this comment

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

Updates to this file won't be part of the real change, just making the build pass

@ecraig12345 ecraig12345 force-pushed the react-17 branch 3 times, most recently from fd22aa3 to 5d7c747 Compare April 8, 2022 01:38
@Hotell Hotell removed their assignment Apr 8, 2022
@ecraig12345
Copy link
Member Author

I'm "officially" dropping this now. After updating the types (which I hadn't done before), some additional issues show up that will be tricky to deal with. The immediate one is that the latest @types/react@17 references Iterable, which is only in es2015.iterable and up and therefore won't work in v8 packages that only use es5.

Also note that after doing the update properly (not with resolutions), there are still a few things that pull in React 16:

  • @fluentui/web-components => @storybook/html => react, react-dom
  • @fluentui/vr-tests => screener-storybook => react, react-dom

And a bunch of things pull in react-is 16, but that may be less of an issue.

"sass": "1.49.11",
"sass-loader": "12.4.0",
"satisfied": "^1.1.1",
"scheduler": "0.19.1",
"scheduler": "0.20.2",
Copy link
Member Author

Choose a reason for hiding this comment

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

scheduler 0.20.2 is used in react-dom 17

@@ -23,8 +23,8 @@
"module": "dist/es/index.js",
"peerDependencies": {
"@fluentui/react-northstar": "0.54.0",
"react": "^16.8.0",
"react-dom": "^16.8.0"
"react": "^16.8.0 || ^17",
Copy link
Member Author

Choose a reason for hiding this comment

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

This was already in some of the northstar packages, but I added it to the rest of them that specify react deps as peers

@@ -36,6 +35,7 @@
"peerDependencies": {
"react": "^16.8.0 || ^17",
"react-dom": "^16.8.0 || ^17",
"react-is": "^16 || ^17",
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not 100% sure what the correct/desirable approach is here, but since it appears that react-is corresponds to a particular react version, it should probably be allowed as either 16 or 17? But I'm not sure if that would cause unexpected breaks for partners who don't already have it installed as a peer.

@@ -16,11 +16,8 @@
"immer": "^9.0.12",
"lodash": "^4.17.15",
"lz-string": "^1.4.4",
"react": "16.14.0",
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved to peers to match other packages

@@ -36,6 +34,7 @@
"jest": "^26.0.0",
"react": ">=16.8.0 <18.0.0",
"react-dom": ">=16.8.0 <18.0.0",
"react-is": ">=16.0.0 <18.0.0",
Copy link
Member Author

Choose a reason for hiding this comment

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

Same question as a couple northstar packages about whether react-is ought to be a peer in the interest of supporting either 16 or 17

@@ -33,7 +33,9 @@ export const resolveShorthand: ResolveShorthandFunction = (value, options) => {
if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || isValidElement(value)) {
resolvedShorthand.children = value;
} else if (typeof value === 'object') {
resolvedShorthand = value;
// TODO: "Type 'readonly ReactNode[]' has no properties in common with type 'UnknownSlotProps'."
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure what happened here, but someone more familiar with these types should probably look into it and fix properly

@ecraig12345
Copy link
Member Author

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.

None yet

4 participants