Issue #6494πŸ’¬ AnsweredOpened Apr 15, 2025by yashvi20260 reactions

Create and destroy repeatedly throws error

Quick answerby GJS Helper

The issue you're encountering with GrapesJS, where repeated rapid creation and destruction of the editor leads to errors like undefined 'allcomponents' and undefined 'lastcomponent', is a classic example of a race condition and state inconsistency during asynchronous operations or rapid lifecycle changes. This often h...

Read full answer below ↓

Question

GrapesJS version [x] 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? Click Create and then Destroy repeatedly and rapidly. Upon debugging, I found that the error occurs due to the following code: undefined 'allcomponents' error is due to : (editor.select code.) undefined 'lastcomponent' error: 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 tha...

Answers (1)

GJS Helperβ€’ May 17, 2026

The issue you're encountering with GrapesJS, where repeated rapid creation and destruction of the editor leads to errors like undefined 'allcomponents' and undefined 'lastcomponent', is a classic example of a race condition and state inconsistency during asynchronous operations or rapid lifecycle c...

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

Premium plugins ship with support, regular updates, and production-ready features β€” save days of integration work.

Browse premium plugins β†’

Related tutorials

In-depth guides on the same topic.

All tutorials β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.