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

change EventGroup.declare to string literal #14085

Closed
wants to merge 5 commits into from

Conversation

jeremy-coleman
Copy link

@jeremy-coleman jeremy-coleman commented Jul 17, 2020

because typescript supports class declarations such as class X { public declare x: number } , using declare has the potential to cause problems for ts parsers supporting classes declaring types. Specifically, this causes an issue with the latest version sucrase. Although the responsibility falls on the parser, it seems pertinent to just avoid this. Changing to ["declare"] is an immediate fix, while renaming it to EventGroup.declareEvent is probably a better long term change. See alangpierce/sucrase#545 for reference.

Pull request checklist

  • Addresses an existing issue: Fixes #0000
  • Include a change request file using $ yarn change

Description of changes

(give an overview)

Focus areas to test

(optional)

because typescript supports class declarations such as `class X {
  public declare x: number
}` , using declare has the potential to cause problems for ts parsers supporting classes declaring types. Specifically, this causes an issue with the latest version sucrase. Although the responsibility falls on the parser, it seems pertinent to just avoid this. Changing to ["declare"] is an immediate fix, while renaming it to EventGroup.declareEvent is probably a better long term change.
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 17, 2020

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 54513ce:

Sandbox Source
Fluent UI Button Configuration
microsoft/fluentui: codesandbox-react-template Configuration
microsoft/fluentui: codesandbox-react-next-template Configuration
microsoft/fluentui: codesandbox-react-northstar-template Configuration

Copy link
Member

@ecraig12345 ecraig12345 left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! In addition to the comment below, you'll need to generate a change file by cloning the repo and running yarn then yarn change.

Comment on lines 310 to 312
//see https://github.com/alangpierce/sucrase/issues/545
/** Declare an event as being supported by this instance of EventGroup. */
public declare(event: string | string[]): void {
public ['declare'](event: string | string[]): void {
Copy link
Member

Choose a reason for hiding this comment

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

I'd recommend adding a short inline explanation for the use of quotes, in addition to the link. Otherwise it's not clear what the link is referring to.

@ghost
Copy link

ghost commented Sep 4, 2020

CLA assistant check
All CLA requirements met.

@msft-github-bot
Copy link
Contributor

Hello @ecraig12345!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msft-github-bot) and give me an instruction to get started! Learn more here.

@ecraig12345
Copy link
Member

@jeremy-coleman Looks like you'll need to sign the CLA before this can merge--you should have gotten a comment about that from the CLA bot when you first opened the PR, but I think it was broken for awhile.

@msft-github-bot
Copy link
Contributor

Perf Analysis

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
BaseButton mount 891 906 5000
ButtonNext mount 602 620 5000
Checkbox mount 1583 1611 5000
CheckboxBase mount 1295 1308 5000
CheckboxNext mount 1690 1689 5000
ChoiceGroup mount 4981 5018 5000
ChoiceGroupNext mount 5017 4961 5000
ComboBox mount 922 950 1000
CommandBar mount 8028 8051 1000
ContextualMenu mount 17181 16881 1000
DefaultButton mount 1188 1135 5000
DetailsRow mount 3614 3600 5000
DetailsRowFast mount 3612 3607 5000
DetailsRowNoStyles mount 3523 3413 5000
Dialog mount 1527 1511 1000
DocumentCardTitle mount 1835 1866 1000
Dropdown mount 2647 2643 5000
FocusZone mount 1839 1867 5000
IconButton mount 1747 1793 5000
Label mount 356 355 5000
Link mount 468 475 5000
LinkNext mount 483 498 5000
MenuButton mount 1465 1498 5000
MessageBar mount 2145 2149 5000
MessageBarNext mount 2152 2125 5000
Nav mount 3316 3271 1000
OverflowSet mount 1481 1437 5000
OverflowSetNext mount 1058 1050 5000
Panel mount 1513 1459 1000
Persona mount 832 838 1000
Pivot mount 1438 1456 1000
PivotNext mount 1424 1413 1000
PrimaryButton mount 1269 1272 5000
SearchBox mount 1341 1314 5000
SearchBoxNext mount 1339 1352 5000
Shimmer mount 2727 2618 5000
ShimmerNext mount 2623 2634 5000
Slider mount 1508 1552 5000
SliderNext mount 1968 1954 5000
SpinButton mount 5006 5063 5000
SpinButtonNext mount 5158 5171 5000
Spinner mount 444 443 5000
SplitButton mount 3192 3238 5000
Stack mount 560 550 5000
StackWithIntrinsicChildren mount 1977 2001 5000
StackWithTextChildren mount 5005 5007 5000
SwatchColorPicker mount 10340 10446 5000
SwatchColorPickerNext mount 10393 10501 5000
TagPicker mount 2840 2842 5000
TeachingBubble mount 53116 51863 5000
TeachingBubbleNext mount 52393 52703 5000
Text mount 448 441 5000
TextField mount 1398 1430 5000
ThemeProvider mount 4359 4297 5000
ThemeProvider virtual-rerender 477 485 5000
Toggle mount 862 844 5000
ToggleNext mount 871 807 5000
button mount 121 126 5000

Perf Analysis (Fluent)

⚠️ 4 potential perf regressions detected

Potential regressions comparing to master

Scenario Current PR Ticks Baseline Ticks Ratio Regression Analysis
ButtonOverridesMissPerf.default 1781 48 37.1:1 analysis
ButtonUseCssNestingPerf.default 1165 46 25.33:1 analysis
ButtonUseCssPerf.default 853 46 18.54:1 analysis
ChatWithPopoverPerf.default 509 471 1.08:1 analysis
Perf comparison
Status Scenario Fluent TPI Fabric TPI Ratio Iterations Ticks
🎯 Avatar.Fluent 0.46 0.5 0.92:1 2000 929
🦄 Button.Fluent 0.12 0.2 0.6:1 5000 592
🔧 Checkbox.Fluent 0.69 0.34 2.03:1 1000 689
🎯 Dialog.Fluent 0.16 0.22 0.73:1 5000 823
🔧 Dropdown.Fluent 3.06 0.5 6.12:1 1000 3058
🔧 Icon.Fluent 0.15 0.06 2.5:1 5000 754
🦄 Image.Fluent 0.08 0.12 0.67:1 5000 414
🔧 Slider.Fluent 1.68 0.38 4.42:1 1000 1677
🔧 Text.Fluent 0.08 0.04 2:1 5000 391
🦄 Tooltip.Fluent 0.12 21.28 0.01:1 5000 604

🔧 Needs work     🎯 On target     🦄 Amazing

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
PortalMinimalPerf.default 176 118 1.49:1
SegmentMinimalPerf.default 409 325 1.26:1
GridMinimalPerf.default 387 310 1.25:1
HeaderMinimalPerf.default 422 340 1.24:1
RefMinimalPerf.default 268 216 1.24:1
ImageMinimalPerf.default 437 356 1.23:1
TextMinimalPerf.default 409 332 1.23:1
FlexMinimalPerf.default 323 266 1.21:1
FormMinimalPerf.default 451 377 1.2:1
LabelMinimalPerf.default 459 386 1.19:1
ReactionMinimalPerf.default 423 362 1.17:1
SkeletonMinimalPerf.default 459 393 1.17:1
StatusMinimalPerf.default 767 655 1.17:1
Text.Fluent 391 334 1.17:1
LayoutMinimalPerf.default 438 380 1.15:1
ButtonMinimalPerf.default 190 166 1.14:1
BoxMinimalPerf.default 392 346 1.13:1
ListMinimalPerf.default 518 459 1.13:1
Image.Fluent 414 366 1.13:1
Tooltip.Fluent 604 535 1.13:1
AnimationMinimalPerf.default 440 393 1.12:1
Icon.Fluent 754 675 1.12:1
AttachmentMinimalPerf.default 177 160 1.11:1
DividerMinimalPerf.default 391 352 1.11:1
TooltipMinimalPerf.default 868 785 1.11:1
CardMinimalPerf.default 591 536 1.1:1
IconMinimalPerf.default 711 649 1.1:1
TextAreaMinimalPerf.default 501 454 1.1:1
Button.Fluent 592 536 1.1:1
RadioGroupMinimalPerf.default 453 415 1.09:1
ToolbarMinimalPerf.default 994 916 1.09:1
MenuMinimalPerf.default 914 845 1.08:1
TableMinimalPerf.default 444 410 1.08:1
AccordionMinimalPerf.default 160 149 1.07:1
AttachmentSlotsPerf.default 1199 1123 1.07:1
ChatDuplicateMessagesPerf.default 459 428 1.07:1
DropdownManyItemsPerf.default 799 747 1.07:1
HeaderSlotsPerf.default 826 772 1.07:1
PopupMinimalPerf.default 719 671 1.07:1
ProviderMinimalPerf.default 1021 954 1.07:1
CustomToolbarPrototype.default 4117 3863 1.07:1
Checkbox.Fluent 689 645 1.07:1
Dialog.Fluent 823 766 1.07:1
ButtonSlotsPerf.default 632 597 1.06:1
DialogMinimalPerf.default 816 767 1.06:1
ItemLayoutMinimalPerf.default 1328 1256 1.06:1
CarouselMinimalPerf.default 483 460 1.05:1
ChatMinimalPerf.default 653 619 1.05:1
EmbedMinimalPerf.default 1999 1898 1.05:1
ProviderMergeThemesPerf.default 2116 2014 1.05:1
MenuButtonMinimalPerf.default 1637 1580 1.04:1
TreeMinimalPerf.default 909 873 1.04:1
Avatar.Fluent 929 897 1.04:1
AlertMinimalPerf.default 308 298 1.03:1
InputMinimalPerf.default 1350 1311 1.03:1
LoaderMinimalPerf.default 769 748 1.03:1
VideoMinimalPerf.default 656 634 1.03:1
DropdownMinimalPerf.default 3087 3033 1.02:1
SliderMinimalPerf.default 1661 1625 1.02:1
AvatarMinimalPerf.default 482 475 1.01:1
SplitButtonMinimalPerf.default 3861 3817 1.01:1
Dropdown.Fluent 3058 3039 1.01:1
Slider.Fluent 1677 1665 1.01:1
TableManyItemsPerf.default 2228 2218 1:1
CheckboxMinimalPerf.default 2880 2906 0.99:1
ListWith60ListItems.default 981 1039 0.94:1
TreeWith60ListItems.default 224 242 0.93:1
ListCommonPerf.default 685 950 0.72:1
ListNestedPerf.default 616 901 0.68:1

@msft-github-bot
Copy link
Contributor

This pull request has been automatically marked as stale because it was marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 5 days of this comment. Thank you for your contributions to Fluent UI!

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.

4 participants