Skip to content

Add as prop to allowed props from getNativeElementProps#19883

Merged
theerebuss merged 7 commits intomicrosoft:masterfrom
theerebuss:add-as-to-getnativeprops
Sep 23, 2021
Merged

Add as prop to allowed props from getNativeElementProps#19883
theerebuss merged 7 commits intomicrosoft:masterfrom
theerebuss:add-as-to-getnativeprops

Conversation

@theerebuss
Copy link
Contributor

@theerebuss theerebuss commented Sep 21, 2021

Pull request checklist

Description of changes

  • Added as prop to allowed props of getNativeElementProps.
  • Added as prop to the excluded props for getSlotsCompat as that would change the API for components that are not using simplified prop merging yet.
  • Removed workaround for react-text and react-link.

@fabricteam
Copy link
Collaborator

fabricteam commented Sep 21, 2021

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-accordion
Accordion (including children components)
55.278 kB
17.417 kB
55.263 kB
17.41 kB
15 B
7 B
react-avatar
Avatar
57.897 kB
16.161 kB
57.868 kB
16.154 kB
29 B
7 B
react-badge
Badge
23.969 kB
7.051 kB
23.954 kB
7.04 kB
15 B
11 B
react-badge
CounterBadge
26.959 kB
7.759 kB
26.944 kB
7.751 kB
15 B
8 B
react-button
Button
22.99 kB
6.996 kB
22.961 kB
6.99 kB
29 B
6 B
react-button
CompoundButton
28.273 kB
7.852 kB
28.244 kB
7.843 kB
29 B
9 B
react-button
MenuButton
25.2 kB
7.698 kB
25.171 kB
7.689 kB
29 B
9 B
react-button
Button
30.676 kB
8.827 kB
30.647 kB
8.822 kB
29 B
5 B
react-button
ToggleButton
32.585 kB
7.621 kB
32.556 kB
7.611 kB
29 B
10 B
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
164.384 kB
46.906 kB
164.355 kB
46.895 kB
29 B
11 B
react-components
react-components: FluentProvider & webLightTheme
35.784 kB
11.415 kB
35.769 kB
11.404 kB
15 B
11 B
react-divider
Divider
15.947 kB
5.771 kB
15.918 kB
5.759 kB
29 B
12 B
react-image
Image
9.834 kB
3.962 kB
9.819 kB
3.952 kB
15 B
10 B
react-input
Input
31.666 kB
11.324 kB
31.651 kB
11.318 kB
15 B
6 B
react-label
Label
9.455 kB
3.865 kB
9.426 kB
3.852 kB
29 B
13 B
react-link
Link
11.659 kB
4.606 kB
11.646 kB
4.594 kB
13 B
12 B
react-menu
Menu (including children components)
103.473 kB
31.466 kB
103.458 kB
31.456 kB
15 B
10 B
react-menu
Menu (including selectable components)
105.749 kB
31.819 kB
105.734 kB
31.809 kB
15 B
10 B
react-popover
Popover
100.441 kB
30.091 kB
100.426 kB
30.083 kB
15 B
8 B
react-provider
FluentProvider
15.778 kB
5.793 kB
15.763 kB
5.783 kB
15 B
10 B
react-slider
Slider
31.978 kB
10.079 kB
31.963 kB
10.072 kB
15 B
7 B
react-switch
Switch
18.868 kB
6.305 kB
18.853 kB
6.296 kB
15 B
9 B
react-text
Text - Default
11.738 kB
4.445 kB
11.73 kB
4.441 kB
8 B
4 B
react-text
Text - Wrappers
15.36 kB
4.749 kB
15.352 kB
4.741 kB
8 B
8 B
react-tooltip
Tooltip
46.078 kB
15.679 kB
46.049 kB
15.671 kB
29 B
8 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-badge
PresenseBadge
237 B
177 B
react-make-styles
makeStaticStyles (runtime)
7.59 kB
3.321 kB
react-make-styles
makeStyles + mergeClasses (runtime)
22.135 kB
8.356 kB
react-make-styles
makeStyles + mergeClasses (build time)
2.557 kB
1.202 kB
react-portal
Portal
6.725 kB
2.237 kB
react-positioning
usePopper
23.145 kB
7.942 kB
react-utilities
SSRProvider
213 B
170 B
🤖 This report was generated against b551b682cff01f796bd7e381be96e86720e07f7a

@size-auditor
Copy link

size-auditor bot commented Sep 21, 2021

Asset size changes

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

Baseline commit: b551b682cff01f796bd7e381be96e86720e07f7a (build)

@fabricteam
Copy link
Collaborator

fabricteam commented Sep 21, 2021

Perf Analysis (@fluentui/react)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 1029 1051 5000
BaseButton mount 1001 1013 5000
Breadcrumb mount 2723 2729 1000
ButtonNext mount 496 491 5000
Checkbox mount 1686 1693 5000
CheckboxBase mount 1442 1430 5000
ChoiceGroup mount 5181 5225 5000
ComboBox mount 1068 1050 1000
CommandBar mount 10827 10735 1000
ContextualMenu mount 6862 6892 1000
DefaultButton mount 1251 1260 5000
DetailsRow mount 4001 4062 5000
DetailsRowFast mount 4071 4059 5000
DetailsRowNoStyles mount 3797 3788 5000
Dialog mount 2561 2605 1000
DocumentCardTitle mount 160 172 1000
Dropdown mount 3489 3442 5000
FluentProviderNext mount 7250 7094 5000
FluentProviderWithTheme mount 351 350 10
FluentProviderWithTheme virtual-rerender 100 100 10
FluentProviderWithTheme virtual-rerender-with-unmount 463 485 10
FocusTrapZone mount 1911 1948 5000
FocusZone mount 1881 1867 5000
IconButton mount 1937 1953 5000
Label mount 362 360 5000
Layer mount 3132 3229 5000
Link mount 512 512 5000
MakeStyles mount 1861 1868 50000
MenuButton mount 1685 1674 5000
MessageBar mount 2112 2149 5000
Nav mount 3546 3595 1000
OverflowSet mount 1175 1211 5000
Panel mount 2474 2465 1000
Persona mount 892 896 1000
Pivot mount 1612 1555 1000
PrimaryButton mount 1415 1399 5000
Rating mount 8699 8581 5000
SearchBox mount 1493 1478 5000
Shimmer mount 2879 2792 5000
Slider mount 2135 2109 5000
SpinButton mount 5437 5430 5000
Spinner mount 437 457 5000
SplitButton mount 3468 3429 5000
Stack mount 552 543 5000
StackWithIntrinsicChildren mount 1924 1946 5000
StackWithTextChildren mount 5270 5269 5000
SwatchColorPicker mount 11339 11369 5000
Tabs mount 1527 1517 1000
TagPicker mount 2969 2913 5000
TeachingBubble mount 13651 13767 5000
Text mount 497 459 5000
TextField mount 1514 1550 5000
ThemeProvider mount 1235 1275 5000
ThemeProvider virtual-rerender 599 618 5000
ThemeProvider virtual-rerender-with-unmount 2136 2086 5000
Toggle mount 907 894 5000
buttonNative mount 120 121 5000

Perf Analysis (@fluentui/react-northstar)

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
AccordionMinimalPerf.default 201 172 1.17:1
ButtonMinimalPerf.default 223 202 1.1:1
PortalMinimalPerf.default 199 181 1.1:1
IconMinimalPerf.default 751 684 1.1:1
SkeletonMinimalPerf.default 417 389 1.07:1
PopupMinimalPerf.default 656 617 1.06:1
LoaderMinimalPerf.default 790 751 1.05:1
RefMinimalPerf.default 256 243 1.05:1
VideoMinimalPerf.default 741 703 1.05:1
BoxMinimalPerf.default 425 408 1.04:1
FlexMinimalPerf.default 328 315 1.04:1
HeaderMinimalPerf.default 432 417 1.04:1
RadioGroupMinimalPerf.default 521 501 1.04:1
SegmentMinimalPerf.default 425 410 1.04:1
DropdownManyItemsPerf.default 785 762 1.03:1
ListMinimalPerf.default 587 571 1.03:1
TextAreaMinimalPerf.default 604 585 1.03:1
AnimationMinimalPerf.default 458 449 1.02:1
AttachmentMinimalPerf.default 180 177 1.02:1
CardMinimalPerf.default 671 659 1.02:1
ChatWithPopoverPerf.default 450 440 1.02:1
DatepickerMinimalPerf.default 6057 5952 1.02:1
DialogMinimalPerf.default 842 829 1.02:1
DividerMinimalPerf.default 416 406 1.02:1
EmbedMinimalPerf.default 4683 4601 1.02:1
GridMinimalPerf.default 396 389 1.02:1
LayoutMinimalPerf.default 428 419 1.02:1
MenuMinimalPerf.default 963 946 1.02:1
MenuButtonMinimalPerf.default 1861 1823 1.02:1
ToolbarMinimalPerf.default 1078 1052 1.02:1
TooltipMinimalPerf.default 1200 1178 1.02:1
ButtonOverridesMissPerf.default 1959 1938 1.01:1
ButtonSlotsPerf.default 627 618 1.01:1
HeaderSlotsPerf.default 894 881 1.01:1
ItemLayoutMinimalPerf.default 1383 1373 1.01:1
ListNestedPerf.default 655 647 1.01:1
ReactionMinimalPerf.default 441 435 1.01:1
SplitButtonMinimalPerf.default 4780 4715 1.01:1
CustomToolbarPrototype.default 4465 4436 1.01:1
AvatarMinimalPerf.default 238 237 1:1
CarouselMinimalPerf.default 520 518 1:1
DropdownMinimalPerf.default 3357 3369 1:1
InputMinimalPerf.default 1413 1407 1:1
LabelMinimalPerf.default 438 437 1:1
TableManyItemsPerf.default 2184 2186 1:1
TableMinimalPerf.default 464 465 1:1
TreeMinimalPerf.default 905 908 1:1
ChatMinimalPerf.default 731 737 0.99:1
CheckboxMinimalPerf.default 2930 2947 0.99:1
ListCommonPerf.default 729 733 0.99:1
TextMinimalPerf.default 386 389 0.99:1
AlertMinimalPerf.default 301 308 0.98:1
AttachmentSlotsPerf.default 1219 1238 0.98:1
ImageMinimalPerf.default 439 447 0.98:1
ProviderMinimalPerf.default 1253 1276 0.98:1
StatusMinimalPerf.default 746 763 0.98:1
ChatDuplicateMessagesPerf.default 335 347 0.97:1
FormMinimalPerf.default 465 481 0.97:1
ListWith60ListItems.default 721 744 0.97:1
ProviderMergeThemesPerf.default 1787 1834 0.97:1
SliderMinimalPerf.default 1859 1914 0.97:1
RosterPerf.default 1293 1351 0.96:1
TreeWith60ListItems.default 209 224 0.93:1

excludedPropNames?: string[],
): TAttributes {
const allowedPropNames = (tagName && nativeElementMap[tagName]) || htmlElementProperties;
allowedPropNames.as = 1;
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be:

Suggested change
allowedPropNames.as = 1;
allowedPropNames.as = excludedPropNames.indexOf('as') === -1 ? 1 : 0;

So that you respect if they passed as as part of the excluded props.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

excludedProps take precedence over the allowed props. I ended up missing that we use this for getSlotsCompat so I went ahead and excluded as from there too.
Also, added much needed tests 😄

@theerebuss theerebuss requested a review from khmakoto September 22, 2021 11:15
Copy link
Contributor

@tringakrasniqi tringakrasniqi left a comment

Choose a reason for hiding this comment

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

Approving for react-text

Copy link
Contributor

@bsunderhus bsunderhus left a comment

Choose a reason for hiding this comment

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

LGTM

@theerebuss theerebuss merged commit 5351bd2 into microsoft:master Sep 23, 2021
@theerebuss theerebuss deleted the add-as-to-getnativeprops branch September 23, 2021 10:33
mlp73 pushed a commit to mlp73/fluentui that referenced this pull request Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getNativeElementProps does not propagate as prop

5 participants