GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
Other
22.73k stars 4.11k forks source link

BUG: Too much recursion #6211

Closed jlafosse closed 1 month ago

jlafosse commented 1 month ago

GrapesJS version

What browser are you using?

Firefox 131.0.2

Reproducible demo link

https://grapesjs.com/demo-newsletter-editor.html

Describe the bug

How to reproduce the bug?

  1. Go to the grapesjs demo, then import the following html:
<div class="foobar">
    <img data-gjs-locked="true" width="500" src="https://cdn.pixabay.com/photo/2021/12/16/15/26/forest-6874717_1280.jpg">
</div>
  1. Open your browser console.
  2. Rapidly click on the image multiple times.

What is the expected behavior? Should work without errors.

What is the current behavior? This causes a recursion error in FireFox. Chrome does not seem to be affected by this issue. I am testing this on OSX 13.6.9 and I have included a short screen recording.

Uncaught InternalError: too much recursion
    getList Component.ts:1931
    ensureInList Component.ts:1866
    ensureInList Component.ts:1880
    Ke Underscore
    Backbone Backbone
    ensureInList Component.ts:1880
    ensureInList Component.ts:1880
    Ke Underscore
    Backbone Backbone
    ensureInList Component.ts:1880
    ensureInList Component.ts:1880

My suspicion is that the issue is coming from the following function: https://github.com/GrapesJS/grapesjs/blob/dev/packages/core/src/dom_components/model/Components.ts#L373

Thanks.

https://github.com/user-attachments/assets/54b6c40f-d435-41f9-a09f-47450f01523e

Code of Conduct

artf commented 1 month ago

Hey @jlafosse thanks for the report.

I'd not expect that issue with the latest version:

Screenshot 2024-10-21 at 19 00 04

Can you try to check again, please?

jlafosse commented 1 month ago

Indeed, that appears to have fixed the issue! Thank you!

artf commented 1 month ago

🙌 closing then, thanks 🙇‍♂️