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

Fix crash in ContextualMenu when Callout component is loaded asynchronously #19122

Merged
merged 2 commits into from
Jul 23, 2021

Conversation

behowell
Copy link
Contributor

@behowell behowell commented Jul 23, 2021

Pull request checklist

Description of changes

PR #15625 moved the hostElement ref from an inner div of ContextualMenu, to the root Callout element. However, when the Callout component is loaded asynchronously, this can cause a crash when the ref doesn't refer to a fully loaded element.

This change un-merges the forwardedRef and hostElement ref. It still applies the forwarded ref to the root Callout (to maintain the fix from #15625), but puts the hostElement ref back to the inner div.

@size-auditor
Copy link

size-auditor bot commented Jul 23, 2021

Asset size changes

Project Bundle Baseline Size New Size Difference
office-ui-fabric-react fluentui-react-SelectedItemsList 216.026 kB 216.058 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-FloatingPicker 226.437 kB 226.469 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-Facepile 195.759 kB 195.791 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-Panel 185.78 kB 185.812 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-Dropdown 216.561 kB 216.593 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-Pickers 270.573 kB 270.605 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-SpinButton 177.319 kB 177.351 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-DocumentCard 200.558 kB 200.59 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-Grid 166.56 kB 166.592 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-Dialog 195.869 kB 195.901 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-Nav 174.541 kB 174.573 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-SwatchColorPicker 176.005 kB 176.037 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-TeachingBubble 190.532 kB 190.564 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-Breadcrumb 185.469 kB 185.501 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-Button 180.447 kB 180.479 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-ContextualMenu 142.402 kB 142.434 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-CommandBar 186.925 kB 186.957 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-TimePicker 218.608 kB 218.64 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-ComboBox 230.321 kB 230.353 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-ButtonGrid 166.56 kB 166.592 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-Pivot 174.51 kB 174.542 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-MessageBar 174.421 kB 174.453 kB ExceedsBaseline     32 bytes
office-ui-fabric-react fluentui-react-SearchBox 173.388 kB 173.42 kB ExceedsBaseline     32 bytes

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

Baseline commit: 329e03a514d8b4ddf371e8ca13a349e3002f14aa (build)

@fabricteam
Copy link
Collaborator

📊 Bundle size report

🤖 This report was generated against 329e03a514d8b4ddf371e8ca13a349e3002f14aa

@codesandbox-ci
Copy link

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 8aa8a53:

Sandbox Source
Fluent UI React Starter Configuration

@fabricteam
Copy link
Collaborator

Perf Analysis (@fluentui/react)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 863 913 5000
BaseButton mount 1010 987 5000
Breadcrumb mount 2637 2658 1000
ButtonNext mount 443 457 5000
Checkbox mount 1637 1621 5000
CheckboxBase mount 1423 1398 5000
ChoiceGroup mount 5107 5088 5000
ComboBox mount 1093 1033 1000
CommandBar mount 10367 10351 1000
ContextualMenu mount 6566 6507 1000
DefaultButton mount 1235 1212 5000
DetailsRow mount 3963 3902 5000
DetailsRowFast mount 4070 4144 5000
DetailsRowNoStyles mount 3871 4007 5000
Dialog mount 2223 2191 1000
DocumentCardTitle mount 160 172 1000
Dropdown mount 3526 3586 5000
FluentProviderNext mount 6912 6986 5000
FocusTrapZone mount 1939 1847 5000
FocusZone mount 1865 1909 5000
IconButton mount 1900 1864 5000
Label mount 341 347 5000
Layer mount 1887 1892 5000
Link mount 469 479 5000
MakeStyles mount 1797 1831 50000
MenuButton mount 1577 1612 5000
MessageBar mount 2091 2130 5000
Nav mount 3453 3521 1000
OverflowSet mount 1064 1073 5000
Panel mount 2170 2130 1000
Persona mount 885 851 1000
Pivot mount 1495 1458 1000
PrimaryButton mount 1356 1371 5000
Rating mount 8341 8587 5000
SearchBox mount 1447 1445 5000
Shimmer mount 2762 2799 5000
Slider mount 2096 2109 5000
SpinButton mount 5210 5318 5000
Spinner mount 449 440 5000
SplitButton mount 3440 3378 5000
Stack mount 554 555 5000
StackWithIntrinsicChildren mount 1753 1776 5000
StackWithTextChildren mount 5165 5266 5000
SwatchColorPicker mount 11097 11213 5000
Tabs mount 1488 1513 1000
TagPicker mount 2668 2699 5000
TeachingBubble mount 12106 12168 5000
Text mount 483 462 5000
TextField mount 1505 1490 5000
ThemeProvider mount 1246 1264 5000
ThemeProvider virtual-rerender 629 611 5000
Toggle mount 847 872 5000
buttonNative mount 125 104 5000

Perf Analysis (@fluentui/react-northstar)

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
AttachmentMinimalPerf.default 183 170 1.08:1
BoxMinimalPerf.default 398 370 1.08:1
FlexMinimalPerf.default 304 284 1.07:1
CardMinimalPerf.default 677 636 1.06:1
LayoutMinimalPerf.default 397 373 1.06:1
TextMinimalPerf.default 413 391 1.06:1
DropdownManyItemsPerf.default 752 714 1.05:1
ListMinimalPerf.default 568 543 1.05:1
TreeWith60ListItems.default 192 182 1.05:1
CarouselMinimalPerf.default 543 523 1.04:1
HeaderMinimalPerf.default 413 398 1.04:1
ImageMinimalPerf.default 403 386 1.04:1
StatusMinimalPerf.default 749 717 1.04:1
ButtonSlotsPerf.default 632 611 1.03:1
MenuMinimalPerf.default 936 913 1.03:1
RadioGroupMinimalPerf.default 485 472 1.03:1
SegmentMinimalPerf.default 391 381 1.03:1
TableManyItemsPerf.default 2172 2103 1.03:1
HeaderSlotsPerf.default 812 793 1.02:1
InputMinimalPerf.default 1326 1302 1.02:1
PortalMinimalPerf.default 179 175 1.02:1
AvatarMinimalPerf.default 216 214 1.01:1
ChatDuplicateMessagesPerf.default 317 313 1.01:1
CheckboxMinimalPerf.default 2912 2894 1.01:1
GridMinimalPerf.default 394 392 1.01:1
ItemLayoutMinimalPerf.default 1324 1306 1.01:1
LabelMinimalPerf.default 416 410 1.01:1
ListCommonPerf.default 697 691 1.01:1
ListNestedPerf.default 594 590 1.01:1
ProviderMinimalPerf.default 1077 1070 1.01:1
SliderMinimalPerf.default 1623 1610 1.01:1
IconMinimalPerf.default 674 669 1.01:1
ToolbarMinimalPerf.default 1051 1036 1.01:1
TooltipMinimalPerf.default 1106 1100 1.01:1
AnimationMinimalPerf.default 445 446 1:1
AttachmentSlotsPerf.default 1177 1177 1:1
ButtonOverridesMissPerf.default 1852 1854 1:1
DatepickerMinimalPerf.default 5658 5649 1:1
DropdownMinimalPerf.default 3202 3215 1:1
EmbedMinimalPerf.default 4395 4381 1:1
FormMinimalPerf.default 441 441 1:1
ListWith60ListItems.default 674 675 1:1
LoaderMinimalPerf.default 720 718 1:1
ProviderMergeThemesPerf.default 1709 1707 1:1
RefMinimalPerf.default 230 231 1:1
SkeletonMinimalPerf.default 380 381 1:1
TableMinimalPerf.default 447 449 1:1
TextAreaMinimalPerf.default 573 572 1:1
CustomToolbarPrototype.default 4106 4086 1:1
ChatWithPopoverPerf.default 402 405 0.99:1
PopupMinimalPerf.default 625 629 0.99:1
TreeMinimalPerf.default 860 866 0.99:1
AlertMinimalPerf.default 294 300 0.98:1
DialogMinimalPerf.default 781 795 0.98:1
RosterPerf.default 1297 1330 0.98:1
ReactionMinimalPerf.default 404 413 0.98:1
SplitButtonMinimalPerf.default 4135 4227 0.98:1
VideoMinimalPerf.default 687 702 0.98:1
ButtonMinimalPerf.default 192 198 0.97:1
ChatMinimalPerf.default 759 780 0.97:1
MenuButtonMinimalPerf.default 1767 1815 0.97:1
AccordionMinimalPerf.default 167 176 0.95:1
DividerMinimalPerf.default 392 412 0.95:1

@behowell behowell merged commit 2d62b36 into microsoft:master Jul 23, 2021
@behowell behowell deleted the 19058-ContextualMenu-hostElement branch July 23, 2021 21:43
@msft-fluent-ui-bot
Copy link
Collaborator

🎉@fluentui/theme-samples@v8.1.43 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@fluentui/react-toggle@v1.0.0-beta.129 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@fluentui/react-tabs@v1.0.0-beta.131 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@fluentui/react-monaco-editor@v1.1.43 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@fluentui/react-docsite-components@v8.3.4 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@fluentui/react-experiments@v8.1.46 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@fluentui/react-cards@v0.200.5 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@fluentui/react-charting@v5.3.15 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@fluentui/react-date-time@v8.1.43 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@fluentui/azure-themes@v8.1.43 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@fluentui/react@v8.23.9 has been released which incorporates this pull request.:tada:

Handy links:

PeterDraex pushed a commit to PeterDraex/fluentui that referenced this pull request Aug 6, 2021
…nously (microsoft#19122)

PR microsoft#15625 moved the `hostElement` ref from an inner `div` of ContextualMenu, to the root `Callout` element. If the Callout component is loaded asynchronously, this can cause a crash when the ref doesn't refer to a fully loaded element.

This change un-merges the `forwardedRef` and `hostElement` ref. It still applies the forwarded ref to the root Callout (to maintain the fix from microsoft#15625), but puts the `hostElement` ref  back to the inner `div`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants