Issue #1772Opened February 4, 2019by itsallrelative0 reactions

Cannot read property 'indexOf' of undefined

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, 20190 reactions

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

https://jsfiddle.net/h204La5o/

lock[bot]February 7, 20200 reactions

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...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.