BUG: Cannot read properties of undefined (reading 'lastComponent')
Question
GrapesJS version
- I confirm to use the latest version of GrapesJS
What browser are you using?
Version 127.0.6533.89 (Official Build) (64-bit)
Reproducible demo link
### Describe the bug
Please check this.selected has a value of undefined . I used it in react and got an error exception.
/**
* Returns model of the selected component
* @return {Component|null}
* @public
*/
EditorModel.prototype.getSelected = function () {
return this.selected.lastComponent();
};

### Code of Conduct
- [X] I agree to follow this project's Code of ConductAnswers (3)
Hey @Vampire-V please follow properly the bug issue template. We can't help you here without a reproducible demo.
GrapesJS version
- I confirm to use the latest version of GrapesJS
What browser are you using?
Version 127.0.6533.89 (Official Build) (64-bit)
Reproducible demo link
Describe the bug
Please check this.selected has a value of undefined . I used it in react and got an error exception.
/** * Returns model of the selected component * @return {Component|null} * @public */ EditorModel.prototype.getSelected = function () { return this.selected.lastComponent(); };
Code of Conduct
- I agree to follow this project's Code of Conduct
Can you please tell me, Is that issue solved? I have a same issue when i select the open layer manager.
Hey @Vampire-V please follow properly the bug issue template. We can't help you here without a reproducible demo.
Can you please share the solution for that? I have a same issue when i select the open layer manager, this issue raises after i selecting another page in my custom left bar panel.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #5386
BUG: Cannot read properties of undefined (reading 'width')
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Edge Reproducible demo link NA Describe th...
Issue #3861
BUG: JS error when press "s" or "w" key - Cannot read properties of undefined (reading 'indexOf')
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Version 94.0.4606.81 (Official Buil...
Issue #4940
BUG: Destroying and re-initializing produces "Cannot read properties of undefined (reading 'get')"
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Google Chrome Version 110.0.5481.100 (Offi...
Issue #5059
BUG: on second-time use template grapes editor not accepting css which the editor created with random ids on the first time
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Version 111.0.5563.147 (Official Build) (6...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.
