-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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: replace internal useKeyborg() with useKeyborgRef() #31295
fix: replace internal useKeyborg() with useKeyborgRef() #31295
Conversation
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. |
Perf Analysis (
|
Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
---|---|---|---|---|---|
Avatar | mount | 668 | 630 | 5000 | |
Button | mount | 308 | 302 | 5000 | |
Field | mount | 1129 | 1151 | 5000 | |
FluentProvider | mount | 706 | 706 | 5000 | |
FluentProviderWithTheme | mount | 71 | 84 | 10 | |
FluentProviderWithTheme | virtual-rerender | 32 | 33 | 10 | |
FluentProviderWithTheme | virtual-rerender-with-unmount | 73 | 83 | 10 | |
MakeStyles | mount | 847 | 894 | 50000 | |
Persona | mount | 1758 | 1727 | 5000 | |
SpinButton | mount | 1423 | 1433 | 5000 | |
SwatchPicker | mount | 1522 | 1557 | 5000 |
📊 Bundle size reportUnchanged fixtures
|
🕵 fluentuiv9 No visual regressions between this PR and main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I don't get it how simply moving the creation of keyborg instance from useMemo
to useEffect
solved this though.... is there a reason?
@bsunderhus I tried to explain it in PR description, but it seems that I failed. Let me try explain it better with code 🐱 Here is an example: https://stackblitz.com/edit/vitejs-vite-dae6we. We subscribed to notifications about keyboard nav state on a destroyed instance. |
Previous Behavior
focusVisibleRef
inuseActiveDescendant()
was alwaysfalse
fluentui/packages/react-components/react-aria/src/activedescendant/useActiveDescendant.ts
Line 94 in 2f4006a
Keyborg instance is being disposed incorrectly.
What was happening?
React 18, no StrictMode
React 18, StrictMode
New Behavior
Keyborg
instances are created inuseEffect
now and are disposed properly.Related Issue(s)