-
Notifications
You must be signed in to change notification settings - Fork 638
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
[5.0.0-beta.4]: Editing nested elements causes JS violation / Forced reflows #14510
Comments
I’m seeing a slightly different error, using Edge: |
Yep, I've seen that error also, but at some point something occurs that causes the reccuring reflows. Maybe the root problem is common for both errors. |
Hello again! I think the reflow error is related to the toggling of the slideout details sidebar. I'm including some specific steps so that you can replicate more easily in a clean Craft 5 install: Important note: Check this on a screen size where the slideout sidebar is opened by default
Can you replicate the error with the steps above? |
Uh-oh! Sorry, but I have a further update! Even without the sidebar toggling you can trigger the error. Follow the steps above but when you go to step 5 open the title settings of entry type (B), click the checkbox to hide the title label and click |
It almost seems that some javascript is running recursively with each slideout and it just keeps pilling on, and at some point it crosses a threshold and goes mental 🤪 I wouldn't have a problem if this happened after you open a crazy amount of slideouts, but with the new edit workflows it's pretty easy to trigger. My system ram is 64GB so I wouldn't think this could be an issue. |
Hi again @brandonkelly. I have been trying to get to the bottom of this, since it causes severe lag when configuring sections and fields in nested slideouts. I'm not a js expert but I managed to track it down to the resize object in Garnish. I then added a debounce function in Garnish like this:
and used it inside
This seems to solve the problem on my end. Not sure if it's a solution that suits you, but I would be gratefull if you can take a look and maybe improve or adapt it however you like. Thanks! |
This should be fixed for the next Craft 4 and 5 releases, via #14911. |
Perfect! I did some quick testing and it seems the issue is fixed! 🙂 |
Thanks for testing @thupsi! Craft 4.9.1 and 5.1.1 are out with that fix now. |
@brianjhanson Hello again. Alas, it seems I was too quick to mark this issue as solved. That's partly because I haven't found a clean way to reproduce and partly because I had limited time to test thoroughly. In any case, here's some more info:
MutationObserver Log Example:
|
Thanks for the info! That helped me finally get to the bottom of this. I realized that it’s only triggerable when a major window resize change happens, such as the browser tools opening/closing, or the window being resized in some automated way (e.g. window snapping). Tracked down the culprit and got this fixed for the next release 🎉 |
Awesome! Thanks 🙂 |
Craft 4.10.2 and 5.2.2 are out with that fix. Thanks again for all the help! |
What happened?
When editing nested elements, especially more than 3 levels deep (but can be less), it's easy to encounter a JS bug that causes a large number of reccuring "forced reflows", introducing heavy lag in the UI.
I have attached a video of a specific workflow, but I've triggered this bug in a variety of situations:
forced_reflow.mp4
I think if you play around with nested elements it's a pretty common bug to run into, but let me know if you can't reprocuce.
Craft CMS version
5.0.0-beta.4
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered: