Skip to content

BUG: Create and destroy repeatedly throws error #6494

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

Open
2 tasks done
yashvi2026 opened this issue Apr 15, 2025 · 0 comments
Open
2 tasks done

BUG: Create and destroy repeatedly throws error #6494

yashvi2026 opened this issue Apr 15, 2025 · 0 comments

Comments

@yashvi2026
Copy link

GrapesJS version

  • I confirm to use the latest version of GrapesJS

What browser are you using?

Chrome

Reproducible demo link

https://codepen.io/Harshsne/pen/QwwLjBQ

Describe the bug

How to reproduce the bug?

  1. Click Create and then Destroy repeatedly and rapidly.

Upon debugging, I found that the error occurs due to the following code:

  1. undefined 'allcomponents' error is due to : (editor.select code.)
        var wrapper = editor.DomComponents.getWrapper();
        **editor.select(wrapper);**
  1. undefined 'lastcomponent' error:
editor.addComponents({
            type: 'text',
            highlightable: false,
            selectable: false,
            droppable: false,
            draggable: false,
            removable: false,
            copyable: false,
            attributes: { class: 'textbox', "data-placeholder": "Insert your text here" },
            content: "fgfghfg",
            styles: `.textbox{word-break:break-word;}`,
             style: { "height": "110px", "outline": "none !important", "padding": '5px', "color": "grey" }
          });

Adding the style to the component triggers the stylable:change event, which throws an error if your side function is still running and you click Destroy during that time.

Image
I attempted to handle this on my side, but the fix didn’t work.
Any suggestions?

Code of Conduct

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant