-
Notifications
You must be signed in to change notification settings - Fork 843
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
[EuiComboBox] Replace autosizing input dependency with more performant utility #7215
Conversation
4667411
to
9a474b3
Compare
@dej611 I thought you might get a kick out of this PR - as it turns out, the new canvas text utilities you helped add for truncation can be reused to replace the |
9ebc022
to
ca66578
Compare
…s util/logic + minor destructuring/code cleanup in `inputOnChange`
ca66578
to
adcc501
Compare
Preview staging links for this PR:
|
💚 Build Succeeded
History
|
I've ran some tests with this EUI optimization vs current Kibana |
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.
It's always nice to be able to replace an dependency with internal code! Tested by creating long text additions in staging and in prod, and didn't find any differences. I wasn't able to notice a significant performance increase by eye, but there was no delay either (which is a win!)
I only had one comment in regards to naming below, and then this is good to go!
import { TruncationUtils as _TruncationUtils } from './utils'; | ||
|
||
export class CanvasTextUtils { | ||
constructor(_: any) {} |
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.
Do you think it would be helpful to provide an name for this parameter, rather than _
? Or are we using this as a standard?
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.
_
is generally the standard to indicate that a variable is unused but is present for some reason (e.g., in this case I'm adding it so that any test mock usages of it don't throw annoying type errors that are dissimilar to non-mocked class).
You'll notice in VSCode that when a named param is unused, vscode will fade it out and eslint may complain that it's unused, whereas when you rename it to _
it becomes unfaded and typically eslint will stop complaining.
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.
Ah ok! Thank you for the explanation!
@@ -0,0 +1 @@ | |||
- Improved the performance of `EuiComboBox` by removing the `react-autosizer-input` dependency |
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.
🎊
Thanks so much for checking Marco! I'll take "the same performance" over "worse performance" any day :) Just to clarify, it looks like when you reported the issue in #4866 you mentioned that you had to add a bunch of optimizations to reduce the number of rerenders of the |
`v88.5.0`⏩`v88.5.4` This EUI upgrade helps unblock the Shared UX team with some beta serverless nav updates not listed in the below changelog (elastic/eui#7228 and elastic/eui#7248). --- ## [`88.5.4`](https://github.com/elastic/eui/tree/v88.5.4) - This release contains internal changes to a beta component needed by Kibana. ## [`88.5.3`](https://github.com/elastic/eui/tree/v88.5.3) **Bug fixes** - Fixed `EuiComboBox` search input width not resetting correctly on selection ([#7240](elastic/eui#7240)) ## [`88.5.2`](https://github.com/elastic/eui/tree/v88.5.2) **Bug fixes** - Fixed broken `EuiTextTruncate` testenv mocks ([#7234](elastic/eui#7234)) ## [`88.5.1`](https://github.com/elastic/eui/tree/v88.5.1) - Improved the performance of `EuiComboBox` by removing the `react-autosizer-input` dependency ([#7215](elastic/eui#7215)) **Dependency updates** - Updated `react-element-to-jsx-string` to v5.0.0 ([#7214](elastic/eui#7214)) - Removed unused `@types/vfile-message` dependency ([#7214](elastic/eui#7214))
Summary
closes #4866, and incidentally partially (but not completely) addresses #7080
When I was upgrading
react-autosizer-input
with React 18 support, I started grepping through to see usages and I was like... "Hmm, it's just one usage just for EuiComboBox? This isn't a hard problem to solve, surely we could just roll our own instead..." and it turns out not only can we Do It Ourselves, we can utilize our new canvas rendering text utils to do it way more performantly 🎉QA
General checklist