Issue #5274πŸ’¬ AnsweredOpened August 3, 2023by wunksert1 reactions

Parser bug inside Remix

Quick answerby artf❀ 1

@wunksert it seems like the editor initializes on itself multiple times, are you properly clearing the editor instance with destroy (eg. in your useEffect)?

Read full answer below ↓

Question

GrapesJS version

  • I confirm to use the latest version of GrapesJS

What browser are you using?

Chrome v114

Reproducible demo link

https://github.com/wunksert/remix-grapes-error/tree/main

Describe the bug

How to reproduce the bug?

  1. Clone repo above

  2. npm i

  3. npm run dev you'll see that the grapes iframe and boilerplate is rendered into the canvas.

  4. Try to export and you'll see that all the grapes boilerplate is also rendering into the canvas

  5. Open dev tools and you'll see the error:

Component.ts:910 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'querySelector')
    at o2.getBody (Component.ts:910:16)
    at o4._upFrame (sample.js:20:20)
    at min.js:12:54
    at Array.forEach (<anonymous>)
    at o4.toggleVis (min.js:12:21)
    at o4.run (max.js:13:7)
    at e3.callRun (ShowOffset.ts:16:26)
    at o2.runCommand (index.ts:805:3)
    at n2.updateActive (PropertyFactory.ts:421:47)
    at g (backbone.js:482:10)

Additional context

What is the expected behavior? The editor should render it's boilerplate properly, the same way as it

What is the current behavior? The parser doesn't seem to work. The editor renders the iframe that's meant to encapsulate the editor DOM. It also exports all the grapesJS boilerplate.

If is necessary to execute some code in order to reproduce the bug, paste it here below:

Code of Conduct

  • I agree to follow this project's Code of Conduct

Answers (4)

artfβ€’ August 6, 2023

@wunksert it seems like the editor initializes on itself multiple times, are you properly clearing the editor instance with destroy (eg. in your useEffect)?

wunksertβ€’ August 3, 2023

It might turn out that a fix for this is more simply solved by me editing structure or naming conventions in my project. Happy to do that if it's faster than changing something in GrapesJS core.

artfβ€’ August 3, 2023

yeah definitely not related to the core

ClaudeCodeβ€’ May 17, 2026

Thanks for reporting this, @wunksert.

Great question about Parser bug inside Remix. The recommended approach with Canvas is to use the event-driven API.

Start here:

  1. Check the GrapesJS documentation for your specific module
  2. Look for the on() event listener method
  3. Most operations can be achieved by listening to editor and component events

Common patterns:

// Listen for changes
editor.on('change', () => console.log('something changed'));

// Component lifecycle
editor.on('component:mount', (c) => console.log('component ready', c));
editor.on('component:update', (c) => console.log('component updated', c));

If you're still stuck:

  • Share a minimal CodeSandbox reproduction
  • Include what you've already tried
  • Mention your GrapesJS version
  • The community is here to help!

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.