Issue #1772💬 AnsweredOpened February 4, 2019by itsallrelative0 reactions

Cannot read property 'indexOf' of undefined

Quick answerby artf

Try to disable (and then probably clean) the storage with passing storageManager: {type: null} https://jsfiddle.net/h204La5o/

Read full answer below ↓

Question

Hello,

I am spinning up a new instance of grapeJS, and immediately everything breaks and I get the following error:

Cannot read property 'indexOf' of undefined at grapes.js:6477

My code looks like the following:

<link href="//unpkg.com/grapesjs/dist/css/grapes.min.css" />
    <script src="//unpkg.com/grapesjs"></script>

    <div id="gjs">
        <h1>Hello World Component!</h1>
    </div>
    <div id="blocks"></div>

    <script>
        $(document).ready(function () {
            grapesjs.init({
                // Indicate where to init the editor. You can also pass an HTMLElement
                container: '#gjs',
                // Get the content for the canvas directly from the element
                // As an alternative we could use: `components: '<h1>Hello World Component!</h1>'`,
                components: '<h1>Hello World component!</h1>'
            });
        });
    </script>

It looks like it is trying to return indexOf on self, but self isn't defined. Can you quickly help me resolve this?

return self.indexOf(item) === index;

Answers (2)

artfFebruary 7, 2019

Try to disable (and then probably clean) the storage with passing storageManager: {type: null}

https://jsfiddle.net/h204La5o/

lock[bot]February 7, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

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.