Issue #6086πŸ’¬ AnsweredOpened Aug 23, 2024by jdkcoder1 reactions

Cannot read properties of undefined (reading 'lastComponent') & resizable feature not work

Quick answerby artf❀ 1

You can skip removing the components (instance.value.Components.clear()) as you're destroying the editor anyway This shouldn't generate any error

Read full answer below ↓

Question

GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Edge v128Reproducible demo linkshttps://codesandbox.io/p/devbox/github/jdkcoder/cv-builderhttps://stackblitz.com/github/jdkcoder/cv-builder Describe the bug I'm using GrapesJS in Nuxt.js 3 project, the error Cannot read properties of undefined (reading 'lastComponent') shows after everytime I run clearAll() function in /components/common/LeftSidebar.vue <hr /> And here is how I was trying to implement "resize" feature at /stores/editor.store.js for "Text" block but it doesn't work & I don't know why...

Answers (3)

artfβ€’ Aug 25, 2024

You can skip removing the components (instance.value.Components.clear()) as you're destroying the editor anyway

if (confirm('Are you sure you want to clear the canvas?')) {
      localStorage.clear()
      reRender()
   }

This shouldn't generate any error

WilliamDASILVAβ€’ Aug 24, 2024

@jdkcoder By commenting the reRender function we don't have the issue anymore. The lastComponent error comes from the this.get('selected') in Editor being undefined at some point. And by checking the debugger, it indeed becomes undefined when the reRender is called because it re-initialize grapes....

GJS Helperβ€’ May 17, 2026

It looks like you're encountering two distinct issues in your GrapesJS Nuxt.js 3 project. Let's break them down and provide solutions. Issue 1: Cannot read properties of undefined (reading 'lastComponent') after clearAll() Root Cause This error typically occurs when GrapesJS's internal state, parti...

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.