Editor Undo is removing collection and unable to replace the component
Sorry, but without a reproducible demo, this issue doesn't make sense to me
Read full answer below βQuestion
The collection of the selected component before Undo

The collection of the selected component after Undo

Code to replace the component with new component

Uncaught TypeError: n.getEl is not a function and Uncaught TypeError: t.getSelectors is not function are the errors reported on save. Iβm unable to replace the selected component with new component.
Answers (4)
Sorry, but without a reproducible demo, this issue doesn't make sense to me
Hi artf,
Please find the demo video of the issue grapejs-issue.zip.
Ok, as you're not able to create a reproducible demo, I have to close this...
Thanks for reporting this, @ssmanoj-grapes.
The error TypeError: n.getEl is not a function and Uncaught TypeError: t.getSelectors is not function are the errors reported on save. Iβm unable to replace the selected component with new component.** occurs when ProseMirror attempts to access properties before the component lifecycle is fully initialized. This is a common race condition in GrapesJS.
Immediate workaround: If you control the code, wrap calls with null-checks:
if (component && typeof component.method === 'function') {
// your code
}
Root cause analysis: The ProseMirror doesn't validate state before invoking your method. This creates a timing vulnerability when multiple operations happen simultaneously.
Next steps:
- Try the null-guard workaround above
- Update to the latest GrapesJS β many race conditions have been fixed
- If this persists, share your exact reproduction steps with the team
- Consider adding defensive checks in your own component initialization
This is actively being tracked and should be improved in upcoming releases.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #6152
CSS added via custom code persists after custom code component is removed
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? any Reproducible demo link https://grapesj...
Issue #5090
Component script function runs twice after page save
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? 112.0.5615.137 (Official Build) (arm64) Re...
Issue #5263
Deleting a component without deleting its corresponding style, will adding new components later cause style conflicts?
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? latest version of Chrome Reproducible demo...
Issue #4947
Undo manager not working properly on undoing a remove action
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Chrome - version 110.0.5481.100 (Official Bu...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins β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.
Tutorial
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
Tutorial
GrapesJS Inline RTE Plugins Update: CKEditor 5 v0.1.4 and Froala Inline Text Editor
CKEditor 5 Inline for GrapesJS v0.1.4 fixes Studio SDK toolbar clipping, iframe injection and link balloon bugs. Compare with Froala Inline β both $69.
Tutorial
Embed GrapesJS in Your SaaS: A Weekend Guide
Embed GrapesJS in your SaaS and ship a white-label page builder over a weekend. Honest tradeoffs, real code, and the plugins that close the UX gap.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.