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
Find the Right GrapesJS Plugin in Seconds: Smarter Discovery Is Live
We're shipping a set of discovery upgrades. New label filters, a proper compatibility switch for GrapesJS vs Studio, one-click and a smarter sort bar.
Tutorial
GJS Market 2.0 - Donations, Tracking, Labels and Better Product Discovery
Weโve rolled out a new set of GrapesJS marketplace updates across GJS Market, focused on improving how creators distribute products
Tutorial
Preset DevFuture 2.0 โ New Update Released
Preset continues evolving as a clean, production-ready starting point for building visual editors powered by GrapesJS
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.