-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Multiple autocompleters can crash #41709
Comments
Looping @chad1008 in for thoughts! |
Good catch, thanks for the ping @johngodley. I can definitely reproduce... I'll look into a fix! |
Update: Current testing points to I have a tentative fix working locally when combined with the fixes in a separate, but related PR (#41749). I want to dig a little deeper into the details of what was triggering the loop, and how, to make sure this fix isn't missing anything else. |
The PR introducing this issue has been reverted (##41820) and will land in the v13.5 release next week, so I'm closing this for now. I'll be taking another pass at that refactor in the future and will keep this regression in mind to avoid it going forward! |
Description
If you have multiple autocompleters then they can cause a crash or browser freeze.
I've traced this down to #41382, specifically this line:
https://github.com/WordPress/gutenberg/pull/41382/files#diff-9cfb2f5fedb0b684384a354cc972272fc659f9cb6e66ea5dcd77bb15feacd989R382
If you have more than one autocompleter then it seems to cause an infinite loop. If you're lucky this results in a crash, if you're not the browser freezes.
Step-by-step reproduction instructions
It's a little hard to recreate on a default Gutenberg, but you can do the following:
packages/editor/src/hooks/default-autocompleters.js
and add a copy of the user autocompleter but with a different trigger prefix. Compile this.+user @user +user @user +user
useEffect
. I suspect that theuseEffect
is causing thecompleters
dependency to change and so it keeps being called.Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: