Issue #3325๐Ÿ’ฌ AnsweredOpened March 9, 2021by mmotov0 reactions

JSON.stringify(this.editor.getComponents()) Error

Quick answerby yucomds

Same error here ... do you have a solution? [EDIT] Downgrading seems to be the only solution for now

Read full answer below โ†“

Question

Version: 0.16.44

Hi there! I have remote storage for pages, and recently I faced an issue when saving page, JSON.stringify(editor.getComponents()) started to throw error Uncaught TypeError: e[M].getId is not a function.

I investigated the already saved JSON representation of the page and found out that it fails on this part

[
  {
    "tagName": "form",
    "type": "form",
    "attributes": {
      "method": "POST",
      "id": "form-id"
    },
    "components": [],
    "__symbol": "if5s0j"
  }
]

I don't know what's the purpose of the __symbol key, but without it, everything works fine. This issue occurs only on few pages, but I'm afraid that it might happen again on other pages.

Answers (4)

yucomdsโ€ข March 9, 2021

Same error here ... do you have a solution?

[EDIT] Downgrading seems to be the only solution for now

josfh2005โ€ข March 10, 2021

Same problem here, if I preprocess the components and remove that attribute (__symbol) before load the Editor the template works fine.

Is the a way @artf to disable the symbols for now?

artfโ€ข March 21, 2021

Yeah unfortunately the previous version of grapesjs had a bug that created symbols involuntary. In the current version, the bug is fixed and symbols are disabled, but unfortunately, this still happens if you try to load a component with a saved symbol reference (created by the bug). I'll add a patch for this issue in the next release, for now, I'd follow Josรจ's advice and remove all __symbol references before loading the editor.

ClaudeCodeโ€ข May 17, 2026

Thanks for reporting this, @mmotov.

The error **TypeError: e[M].getId is not a function`. ** 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.getComponents === 'function') {
  // your code
}

Root cause analysis: The ProseMirror doesn't validate state before invoking getComponents(). 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.