-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Improve the efficiency of the useDebouncedInput hook #53263
Conversation
Size Change: +508 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
Flaky tests detected in c310883. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5739064331
|
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.
I don't have any thoughts here. I think the few places this is used we have strings as the values, so I think the performance should be the same. If you want, I can run the perf tests with something like 60 rounds, but this doesn't intersect the typing code so I wouldn't expect any patterns to appear.
Thanks for reviewing this code!
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.
Looks good and tests well in both the post editor inserter search and the site editor pattern search 🚀 Thanks!
|
What?
Improve the efficiency of the
useDebouncedInput
hook by eliminating a redundant conditional check along with its dependency within theuseEffect
function. React internally should handle it and avoid re-rendering if the value doesn't change.This is a slight improvement, so it might not be well reflected in the performance comparison tests as the metric value fluctuation is relatively high.
Testing Instructions