Skip to content

Generic Virtualizer#25451

Merged
Mitch-At-Work merged 3 commits into
microsoft:masterfrom
Mitch-At-Work:user/mifraser/list-virtualizer
Jan 18, 2023
Merged

Generic Virtualizer#25451
Mitch-At-Work merged 3 commits into
microsoft:masterfrom
Mitch-At-Work:user/mifraser/list-virtualizer

Conversation

@Mitch-At-Work

@Mitch-At-Work Mitch-At-Work commented Oct 31, 2022

Copy link
Copy Markdown
Contributor

V9 Virtualizer Draft

  • Code is up-to-date with the master branch
  • Your changes are covered by tests (if possible) - basic tests for unstable to ensure virtualization is working.
  • You've run yarn change locally

Current Behavior

Currently, Virtualization is provided by several OSS libraries that enable scroll detection and positioning of components, these libraries, while excellent, do not adhere to the same design philosophy as V9 in terms of composability and user access.

New Behavior

This Virtualizer is intended to be a composable, generic wrapper for long-length children with minimal DOM changes, it uses the intersection observer library to optimize and remove scroll callback loops and instead only initiate calculations and re-renders when required.

This library can be used vertically or horizontally, in regular or reverse order, is compatible with generic types and a multitude of List, Grid, or Table implementations. If you wish to provide a scroll view, the ref may be passed in to optimize further, however it is not required.

Related Issue(s)

TBD

Fixes #

@fabricteam

fabricteam commented Oct 31, 2022

Copy link
Copy Markdown
Collaborator

📊 Bundle size report

Unchanged fixtures
Package & Exports Size (minified/GZIP)
global-context
createContext
533 B
341 B
global-context
createContextSelector
554 B
348 B
priority-overflow
createOverflowManager
3.182 kB
1.308 kB
react-accordion
Accordion (including children components)
80.097 kB
24.712 kB
react-alert
Alert
85.912 kB
21.686 kB
react-avatar
Avatar
52.812 kB
14.689 kB
react-avatar
AvatarGroup
15.42 kB
6.167 kB
react-avatar
AvatarGroupItem
69.03 kB
18.984 kB
react-badge
Badge
23.78 kB
7.542 kB
react-badge
CounterBadge
24.67 kB
7.825 kB
react-badge
PresenceBadge
25.728 kB
7.439 kB
react-button
Button
33.354 kB
8.779 kB
react-button
CompoundButton
40.384 kB
10.127 kB
react-button
MenuButton
38.043 kB
10.096 kB
react-button
SplitButton
45.488 kB
11.501 kB
react-button
ToggleButton
49.184 kB
10.875 kB
react-card
Card - All
77.975 kB
22.496 kB
react-card
Card
72.92 kB
21.108 kB
react-card
CardFooter
9.04 kB
3.807 kB
react-card
CardHeader
10.805 kB
4.443 kB
react-card
CardPreview
9.847 kB
4.159 kB
react-checkbox
Checkbox
32.658 kB
10.169 kB
react-checkbox
CheckboxField
40.095 kB
12.174 kB
react-combobox
Combobox (including child components)
80.888 kB
25.842 kB
react-combobox
ComboboxField
79.069 kB
26.075 kB
react-combobox
Dropdown (including child components)
79.674 kB
25.637 kB
react-components
react-components: Button, FluentProvider & webLightTheme
59.888 kB
16.652 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
187.539 kB
52.638 kB
react-components
react-components: FluentProvider & webLightTheme
34.379 kB
11.322 kB
react-dialog
Dialog (including children components)
83.464 kB
24.916 kB
react-divider
Divider
16.938 kB
6.103 kB
react-image
Image
11.259 kB
4.473 kB
react-infobutton
InfoButton
118.422 kB
35.99 kB
react-input
Input
24.673 kB
8.065 kB
react-input
InputField
34.903 kB
10.955 kB
react-label
Label
9.817 kB
4.067 kB
react-link
Link
12.285 kB
5.063 kB
react-menu
Menu (including children components)
117.988 kB
36.475 kB
react-menu
Menu (including selectable components)
121.057 kB
36.981 kB
react-overflow
hooks only
11.033 kB
4.198 kB
react-persona
Persona
58.849 kB
16.348 kB
react-popover
Popover
105.54 kB
32.507 kB
react-portal
Portal
11.086 kB
4.093 kB
react-portal-compat
PortalCompatProvider
6.069 kB
2.053 kB
react-positioning
usePositioning
20.856 kB
7.766 kB
react-progress
ProgressBar
13.578 kB
5.235 kB
react-progress
ProgressField
23.9 kB
8.278 kB
react-provider
FluentProvider
16.446 kB
6.127 kB
react-radio
Radio
32.247 kB
10.468 kB
react-radio
RadioGroup
14.718 kB
5.886 kB
react-radio
RadioGroupField
25.032 kB
9.031 kB
react-select
Select
23.963 kB
8.206 kB
react-select
SelectField
33.231 kB
10.646 kB
react-slider
Slider
32.663 kB
10.403 kB
react-slider
SliderField
42.695 kB
13.355 kB
react-spinbutton
SpinButton
44.989 kB
12.975 kB
react-spinbutton
SpinButtonField
54.293 kB
15.458 kB
react-spinner
Spinner
20.445 kB
6.621 kB
react-switch
Switch
27.791 kB
8.605 kB
react-switch
SwitchField
35.121 kB
10.61 kB
react-table
DataGrid
129.317 kB
35.207 kB
react-table
Table (Primitives only)
42.971 kB
11.781 kB
react-table
Table as DataGrid
127.563 kB
32.864 kB
react-table
Table (Selection only)
81 kB
20.124 kB
react-table
Table (Sort only)
80.429 kB
19.97 kB
react-text
Text - Default
12.261 kB
4.819 kB
react-text
Text - Wrappers
15.571 kB
5.23 kB
react-textarea
Textarea
26.156 kB
8.508 kB
react-textarea
TextareaField
36.388 kB
11.372 kB
react-theme
Single theme token import
69 B
89 B
react-theme
Teams: all themes
30.908 kB
6.714 kB
react-theme
Teams: Light theme
17.776 kB
5.141 kB
react-tooltip
Tooltip
43.49 kB
15.213 kB
react-utilities
SSRProvider
180 B
159 B
🤖 This report was generated against 87cdc8bf6f3aa6e24241a143044bfeb9c5d6e0d0

@size-auditor

size-auditor Bot commented Oct 31, 2022

Copy link
Copy Markdown

Asset size changes

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

Baseline commit: 87cdc8bf6f3aa6e24241a143044bfeb9c5d6e0d0 (build)

@fabricteam

fabricteam commented Oct 31, 2022

Copy link
Copy Markdown
Collaborator

Perf Analysis (@fluentui/react-components)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 1259 1265 5000
Button mount 917 928 5000
FluentProvider mount 1511 1499 5000
FluentProviderWithTheme mount 580 583 10
FluentProviderWithTheme virtual-rerender 541 549 10
FluentProviderWithTheme virtual-rerender-with-unmount 576 579 10
InfoButton mount 518 518 5000
MakeStyles mount 1974 1965 50000
Persona mount 2785 2797 5000
SpinButton mount 2320 2333 5000

@fabricteam

fabricteam commented Oct 31, 2022

Copy link
Copy Markdown
Collaborator

Perf Analysis (@fluentui/react-northstar)

⚠️ No perf measurements available

@fabricteam

fabricteam commented Oct 31, 2022

Copy link
Copy Markdown
Collaborator

Perf Analysis (@fluentui/react)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
BaseButton mount 1250 1193 5000
Breadcrumb mount 2860 2825 1000
Checkbox mount 2706 2749 5000
CheckboxBase mount 2371 2403 5000
ChoiceGroup mount 4340 4356 5000
ComboBox mount 1221 1183 1000
CommandBar mount 9595 9462 1000
ContextualMenu mount 10832 10824 1000
DefaultButton mount 1364 1372 5000
DetailsRow mount 3364 3392 5000
DetailsRowFast mount 3444 3396 5000
DetailsRowNoStyles mount 3228 3268 5000
Dialog mount 2983 2975 1000
DocumentCardTitle mount 570 582 1000
Dropdown mount 3180 3158 5000
FocusTrapZone mount 1980 1995 5000
FocusZone mount 1991 1952 5000
GroupedList mount 1881 2099 2
GroupedList virtual-rerender 1140 1126 2
GroupedList virtual-rerender-with-unmount 1654 1617 2
GroupedListV2 mount 561 598 2
GroupedListV2 virtual-rerender 545 549 2
GroupedListV2 virtual-rerender-with-unmount 568 559 2
IconButton mount 1803 1807 5000
Label mount 751 787 5000
Layer mount 4202 4212 5000
Link mount 842 905 5000
MenuButton mount 1600 1608 5000
MessageBar mount 2340 2326 5000
Nav mount 3071 3106 1000
OverflowSet mount 1417 1428 5000
Panel mount 2460 2578 1000
Persona mount 1303 1297 1000
Pivot mount 1491 1507 1000
PrimaryButton mount 1471 1478 5000
Rating mount 7016 7129 5000
SearchBox mount 1518 1549 5000
Shimmer mount 2893 2923 5000
Slider mount 2119 2102 5000
SpinButton mount 4280 4265 5000
Spinner mount 836 827 5000
SplitButton mount 2872 2820 5000
Stack mount 865 859 5000
StackWithIntrinsicChildren mount 2242 2285 5000
StackWithTextChildren mount 4947 4905 5000
SwatchColorPicker mount 9420 9507 5000
TagPicker mount 2317 2371 5000
TeachingBubble mount 81224 82055 5000
Text mount 826 833 5000
TextField mount 1533 1555 5000
ThemeProvider mount 1472 1485 5000
ThemeProvider virtual-rerender 1137 1159 5000
ThemeProvider virtual-rerender-with-unmount 1995 2001 5000
Toggle mount 1139 1146 5000
buttonNative mount 543 537 5000

@codesandbox-ci

codesandbox-ci Bot commented Nov 15, 2022

Copy link
Copy Markdown

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

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

@Mitch-At-Work
Mitch-At-Work force-pushed the user/mifraser/list-virtualizer branch from 63f8373 to 557c37d Compare November 30, 2022 17:29
@Mitch-At-Work
Mitch-At-Work marked this pull request as ready for review November 30, 2022 17:49
@fabricteam

fabricteam commented Nov 30, 2022

Copy link
Copy Markdown
Collaborator

🕵 fluentuiv9 No visual regressions between this PR and main

@spmonahan spmonahan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I've been working quite a bit with our virtualization implementation in Fluent v8 so it's exciting to see a new implementation using modern browser features like IntersectionObserver.

Comment thread packages/react-components/react-table/stories/Table/Virtualized.stories.tsx Outdated
Comment thread packages/react-components/virtualizer/src/useVirtualizer.ts Outdated
Comment thread packages/react-components/virtualizer/src/useVirtualizer.ts Outdated
Comment thread packages/react-components/virtualizer/src/useVirtualizer.ts Outdated
Comment thread packages/react-components/virtualizer/src/useVirtualizer.ts Outdated
Comment thread packages/react-components/virtualizer/src/useVirtualizer.ts Outdated
Comment thread packages/react-components/virtualizer/src/useVirtualizer.ts Outdated
@Mitch-At-Work
Mitch-At-Work force-pushed the user/mifraser/list-virtualizer branch from e4ecc25 to 0434337 Compare December 5, 2022 23:01
Comment thread .github/CODEOWNERS Outdated
Comment thread packages/react-components/react-table/stories/Table/Virtualized.stories.tsx Outdated
Comment thread packages/react-components/virtualizer/src/Virtualizer.types.ts Outdated
Comment thread packages/react-components/virtualizer/src/Virtualizer.types.ts Outdated

@behowell behowell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Adding some comments, mostly about the component model and coding conventions. I'll let @ling1726 continue to review the functionality of the virtualizer. Thanks!

Comment thread packages/react-components/virtualizer/src/useVirtualizerStyles.ts Outdated
Comment thread packages/react-components/virtualizer/src/useVirtualizerStyles.ts Outdated
Comment thread packages/react-components/virtualizer/src/useVirtualizerStyles.ts Outdated
Comment thread packages/react-components/virtualizer/src/useVirtualizerStyles.ts Outdated
Comment thread packages/react-components/virtualizer/src/useVirtualizer.ts Outdated
Comment thread packages/react-components/virtualizer/src/Virtualizer.types.ts Outdated
Comment thread packages/react-components/virtualizer/src/renderVirtualizer.tsx Outdated
Comment thread packages/react-components/virtualizer/package.json Outdated
Comment thread packages/react-components/virtualizer/src/Virtualizer.types.ts Outdated
Comment thread packages/react-components/virtualizer/src/useVirtualizer.ts Outdated
@Mitch-At-Work Mitch-At-Work changed the title Draft: Generic Virtualizer Unstable: Generic Virtualizer Dec 8, 2022
@Mitch-At-Work Mitch-At-Work changed the title Unstable: Generic Virtualizer Generic Virtualizer Dec 8, 2022
@fabricteam

fabricteam commented Dec 8, 2022

Copy link
Copy Markdown
Collaborator

🕵 FluentUI-v0 No visual regressions between this PR and main

Comment thread packages/react-components/react-virtualizer/src/useVirtualizer.ts Outdated
@Mitch-At-Work
Mitch-At-Work force-pushed the user/mifraser/list-virtualizer branch from 8861cbd to f3397c1 Compare January 17, 2023 21:50
Comment thread .github/CODEOWNERS
@Mitch-At-Work
Mitch-At-Work force-pushed the user/mifraser/list-virtualizer branch from f3397c1 to 1cb5013 Compare January 17, 2023 23:45
Comment thread .github/CODEOWNERS
@Mitch-At-Work
Mitch-At-Work force-pushed the user/mifraser/list-virtualizer branch from 889bd1d to 8dce50f Compare January 18, 2023 17:25
@fabricteam

Copy link
Copy Markdown
Collaborator

🕵 fluentuiv8 No visual regressions between this PR and main

@Mitch-At-Work
Mitch-At-Work merged commit 547235c into microsoft:master Jan 18, 2023
Comment on lines +39 to +42
"@types/react": ">=16.8.0 <18.0.0",
"@types/react-dom": ">=16.8.0 <18.0.0",
"react": ">=16.8.0 <18.0.0",
"react-dom": ">=16.8.0 <18.0.0"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These should be up to 19.0.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Causing this bug #26859

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.

9 participants