Fix onResolveSuggestions not being called after component is remounted in react 18 strict mode#28227
Merged
khmakoto merged 2 commits intomicrosoft:masterfrom Sep 9, 2024
Conversation
Contributor
Author
|
I haven't added any tests for this. I don't think I can repeat the behaviour manually without putting this into react 18 with strict mode... but if anyone has suggestions I can try. |
26827a7 to
00b8870
Compare
Collaborator
📊 Bundle size report🤖 This report was generated against 02c7384de10ee35cc4db1a2132c32de59db58e1f |
Contributor
Author
|
@microsoft-github-policy-service agree |
Asset size changes
Baseline commit: 02c7384de10ee35cc4db1a2132c32de59db58e1f (build) |
|
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 00b8870:
|
Collaborator
🕵 fluentuiv8 No visual regressions between this PR and main |
Collaborator
Perf Analysis (
|
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| BaseButton | mount | 607 | 577 | 5000 | |
| Breadcrumb | mount | 1581 | 1574 | 1000 | |
| Checkbox | mount | 1619 | 1606 | 5000 | |
| CheckboxBase | mount | 1390 | 1399 | 5000 | |
| ChoiceGroup | mount | 2773 | 2775 | 5000 | |
| ComboBox | mount | 618 | 617 | 1000 | |
| CommandBar | mount | 5845 | 5802 | 1000 | |
| ContextualMenu | mount | 11180 | 11139 | 1000 | |
| DefaultButton | mount | 732 | 703 | 5000 | |
| DetailsRow | mount | 2076 | 2058 | 5000 | |
| DetailsRowFast | mount | 2062 | 2083 | 5000 | |
| DetailsRowNoStyles | mount | 1890 | 1902 | 5000 | |
| Dialog | mount | 2616 | 2483 | 1000 | |
| DocumentCardTitle | mount | 213 | 207 | 1000 | |
| Dropdown | mount | 1886 | 1861 | 5000 | |
| FocusTrapZone | mount | 1062 | 1086 | 5000 | |
| FocusZone | mount | 987 | 992 | 5000 | |
| GroupedList | mount | 39258 | 39365 | 2 | |
| GroupedList | virtual-rerender | 18980 | 19151 | 2 | |
| GroupedList | virtual-rerender-with-unmount | 47881 | 47634 | 2 | |
| GroupedListV2 | mount | 221 | 210 | 2 | |
| GroupedListV2 | virtual-rerender | 190 | 200 | 2 | |
| GroupedListV2 | virtual-rerender-with-unmount | 214 | 205 | 2 | |
| IconButton | mount | 1008 | 1015 | 5000 | |
| Label | mount | 302 | 314 | 5000 | |
| Layer | mount | 2577 | 2603 | 5000 | |
| Link | mount | 374 | 370 | 5000 | |
| MenuButton | mount | 868 | 868 | 5000 | |
| MessageBar | mount | 20299 | 20163 | 5000 | |
| Nav | mount | 1837 | 1862 | 1000 | |
| OverflowSet | mount | 723 | 729 | 5000 | |
| Panel | mount | 1690 | 1708 | 1000 | |
| Persona | mount | 712 | 702 | 1000 | |
| Pivot | mount | 808 | 820 | 1000 | |
| PrimaryButton | mount | 810 | 792 | 5000 | |
| Rating | mount | 4313 | 4376 | 5000 | |
| SearchBox | mount | 862 | 847 | 5000 | |
| Shimmer | mount | 1778 | 1769 | 5000 | |
| Slider | mount | 1262 | 1257 | 5000 | |
| SpinButton | mount | 2683 | 2641 | 5000 | |
| Spinner | mount | 366 | 372 | 5000 | |
| SplitButton | mount | 1724 | 1706 | 5000 | |
| Stack | mount | 390 | 394 | 5000 | |
| StackWithIntrinsicChildren | mount | 824 | 804 | 5000 | |
| StackWithTextChildren | mount | 2499 | 2447 | 5000 | |
| SwatchColorPicker | mount | 5752 | 5710 | 5000 | |
| TagPicker | mount | 1370 | 1294 | 5000 | |
| Text | mount | 347 | 350 | 5000 | |
| TextField | mount | 871 | 876 | 5000 | |
| ThemeProvider | mount | 768 | 795 | 5000 | |
| ThemeProvider | virtual-rerender | 568 | 556 | 5000 | |
| ThemeProvider | virtual-rerender-with-unmount | 1202 | 1202 | 5000 | |
| Toggle | mount | 585 | 576 | 5000 | |
| buttonNative | mount | 186 | 176 | 5000 |
2 tasks
khmakoto
approved these changes
Sep 9, 2024
marcosmoura
added a commit
to marcosmoura/fluentui
that referenced
this pull request
Sep 12, 2024
* master: (77 commits) fix(react-drawer): update scroll state when children changes (microsoft#32818) feat(react-storybook-addon): improve addon to more readable names (microsoft#32815) chore: cleanup react-carousel-preview (microsoft#32475) feat(storybook): add rtl/ltr toggle storybook addon (microsoft#32814) Carousel: Storybook updates and fixing exports/focus (microsoft#32457) release: applying package updates - react v8 release: applying package updates - web-components Update d3 dependency versions to 3.x.x and 4.x.x (microsoft#32463) RFC: Extended Design Tokens for Fluent UI React (microsoft#32058) update doc to reflect setTheme function change (microsoft#32490) fix (react-dialog): Use consistent rounding for clientHeight and innerHeight (microsoft#32480) fix(public-doscite-v9): global styles should not be applied to story elements (microsoft#32472) feat(workspace-plugin): implement verify-packaging executor (microsoft#32403) release: applying package updates - react-components Add strokeDasharray property when optimizeLargeData is true (microsoft#32494) fix(TreeItemLayout): Actions should not unmount between successive mouse events (microsoft#32477) release: applying package updates - react v8 bugfix(react-tree): recover from tabIndex=-1 when TreeItem is removed (microsoft#32442) Fix onResolveSuggestions not being called after component is remounted in react 18 strict mode (microsoft#28227) fix(codeowners): update most packages owned by cxe-red with cxe-prg (microsoft#32445) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previous Behavior
When running in react 18 strict mode, the suggestion list does not display in pickers.
In strict mode, rather than mounting once the component will be unmounted and remounted before continuing with the rest of the initial mount.
BasePickercreates anAsyncobject in its constructor, and disposes it when unmounted. It also wraps_onResolveSuggestionswith a debounced version of itself when mounted.Together this means
_onResolveSuggestionsis wrapped with debounce twice; once correctly and once with a disposedAsyncinstance which turns it into a noop. Therefore_onResolveSuggestionsnever gets called.New Behavior
Asyncis created and disposed on mount and unmount respectively. Not in the constructor._onResolveSuggestionsis only wrapped with debounce once, replacing the original wrapped version rather than applying on top of it.Related Issue(s)