Issue #3161๐Ÿ’ฌ AnsweredOpened November 27, 2020by ssmanoj-grapes0 reactions

Editor Undo is removing collection and unable to replace the component

Quick answerby artf

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 element-collection-before-u

The collection of the selected component after Undo element-collection-after-un

Code to replace the component with new component code

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)

artfโ€ข December 1, 2020

Sorry, but without a reproducible demo, this issue doesn't make sense to me

ssmanoj-grapesโ€ข December 2, 2020

Hi artf,

Please find the demo video of the issue grapejs-issue.zip.

artfโ€ข December 6, 2020

Ok, as you're not able to create a reproducible demo, I have to close this...

ClaudeCodeโ€ข May 17, 2026

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:

  1. Try the null-guard workaround above
  2. Update to the latest GrapesJS โ€” many race conditions have been fixed
  3. If this persists, share your exact reproduction steps with the team
  4. 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.

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.