Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read property 'currentView' of undefined #3926

Closed
kampit opened this issue Mar 27, 2018 · 40 comments
Closed

Uncaught TypeError: Cannot read property 'currentView' of undefined #3926

kampit opened this issue Mar 27, 2018 · 40 comments
Labels
bug Indicates a bug with one or multiple components.

Comments

@kampit
Copy link

kampit commented Mar 27, 2018

After update a new version (current version)

I can't access the elementor view with existing page.

screen shot 2018-03-27 at 11 33 00 pm

@ghost
Copy link

ghost commented Mar 27, 2018

It's the same on my site, just after the update.

@KingYes
Copy link
Member

KingYes commented Mar 27, 2018

Please contact with us in support at elementor.com

@KingYes KingYes added the bug Indicates a bug with one or multiple components. label Mar 27, 2018
@localhost80
Copy link

I get the same issue. Can I downgrade to resolve the issue?

@KingYes
Copy link
Member

KingYes commented Mar 27, 2018

@localhost80 Yes!

@squadcar
Copy link

Same issue, how do we downgrade? There's no information in your docs that I can find :/

@localhost80
Copy link

Yo bro. I did but its all messed up. I will wait for update.

@localhost80
Copy link

You can download previous releases in github. its not working for me.

@squadcar
Copy link

Ahh right, rolling back to 1.9.8 fixed it for me.

@localhost80
Copy link

localhost80 commented Mar 27, 2018 via email

@KingYes
Copy link
Member

KingYes commented Mar 27, 2018

Just download this file and replace with your own: https://plugins.svn.wordpress.org/elementor/tags/2.0.0/assets/js/editor.min.js

@localhost80
Copy link

going to wait for the release. the downgrade worked. its groovy KingYes.

@coressel
Copy link

coressel commented Mar 27, 2018

Worked for me thanks @KingYes thanks

@closeer-tecnologia
Copy link

@KingYes Great! it worked here

@parfilov
Copy link

Some of my subscribers have the same troubles.
Other plugins are disabled, memory_limit — 256. No success.

@bainternet
Copy link
Contributor

Please update to 2.0.2!!!
make sure to clear browser and server cache,

Thanks for reporting.

@bpongy
Copy link

bpongy commented May 4, 2018

same bug again on other versions (2.0.x)

Uncaught TypeError: Cannot read property 'currentView' of undefined

@Choufourax
Copy link

Hello, I have similar problem with a message
Cannot read property 'data' of undefined elementor
Since I upgrade from 1.9.x to 2.0.10

  • I tried with 2.0.10 2.0.11 and and 2.0.12, same issue.
  • I tried with all pugin deactivate except Elementor and Elementor Pro, same issue.
  • I tried by just create a new blank post with elementor, same issue.
  • Without Elementor Pro, it works.

I roll back to Elementor version 2.0.0 as suggested in this topic, it works.

@bpongy
Copy link

bpongy commented May 17, 2018

@KingYes please reopen this issue

@tryonlinux
Copy link

Same issue after update to the latest.

editor.min.js?ver=2.0.12:2 Uncaught TypeError: Cannot read property 'data' of undefined
at n.initSettings (editor.min.js?ver=2.0.12:2)
at n.initialize (editor.min.js?ver=2.0.12:2)
at n.e.Model (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at new n (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at new model (editor.min.js?ver=2.0.12:2)
at n._prepareModel (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at n.set (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at n.add (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at n.add (editor.min.js?ver=2.0.12:2)
at n.reset (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at n.e.Collection (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at new n (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at n.initialize (editor.min.js?ver=2.0.12:2)
at n.e.Model (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at new n (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at new model (editor.min.js?ver=2.0.12:2)
at n._prepareModel (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at n.set (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at n.add (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at n.add (editor.min.js?ver=2.0.12:2)
at n.reset (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at n.e.Collection (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at new n (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at n.initialize (editor.min.js?ver=2.0.12:2)
at n.e.Model (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at new n (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at new model (editor.min.js?ver=2.0.12:2)
at n._prepareModel (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at n.set (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at n.add (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at n.add (editor.min.js?ver=2.0.12:2)
at n.reset (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at n.e.Collection (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at new n (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:18)
at n.initElements (editor.min.js?ver=2.0.12:2)
at n.onPreviewLoaded (editor.min.js?ver=2.0.12:2)
at HTMLIFrameElement.dispatch (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:11)
at HTMLIFrameElement.r.handle (load-scripts.php?c=0&load[]=underscore,shortcode,utils,jquery-core,jquery-migrate,backbone,wp-util,wp-backbone,media-models,moxiejs,plupload,wp-plupload,jqu&load[]=ery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable&ver=4.9.6:11)

@pyrexx11
Copy link

Having same issue on Version 2.0.14.

@crtlf
Copy link

crtlf commented Jun 11, 2018

Same on 2.0.15 with Elementor Pro 2.0.10 with this message
Cannot read property 'data' of undefined

I have 3 different scenarios

  • Elementor loads and works
  • Elementor loads but can't add, edit or remove elements
  • Elementor does not load

Still can't find out why it sometimes works or crash

@bpongy
Copy link

bpongy commented Jun 11, 2018

@KingYes can you please open this issue ?

@crtlf
Copy link

crtlf commented Jun 12, 2018

Juste updated to Elementor 2.0.16 with v. Pro 2.0.11, same issue.

@tryonlinux
Copy link

If anyone is having issues with it and single page Themes that take multiple pages and stuff them together I was able to edit all my pages by creating a dummy page with no title or content and setting it as first page/single page template. Then you can freely edit the normal pages without any ill effect

@encreinformatique
Copy link

Same issue for me on several Wordpress:

TypeError: Cannot read property 'data' of undefined
			at https://www.biciscope.com/wp-content/plugins/elementor/assets/js/editor.min.js?ver=2.0.16 - 2:107653
			2018-06-13 10:17 +00:00
			x 5 times

Tried the editor.min.js of 2.0.0, 2.0.10, 2.0.11, 2.0.12, 2.0.14 and 2.0.16 without success.

@crtlf
Copy link

crtlf commented Jun 14, 2018

Looks like I found a solution. I'm not saying that it will be your solution but it works in my specific case.

The content I am editing with Elementor is calling content-single.php, and into this template, I have a list of related content, called like that :

$args =  array(
  'post_type' => 'my_custom_content_type',
  'post__not_in' => array($post_id),
  'posts_per_page' => '3'
);
$custom_query = new WP_Query($args);
while ($custom_query->have_posts()) : $custom_query->the_post();
  get_template_part('templates/block/block-small');
endwhile;

If I remove the post__not_in condition, it works.

To make it work without changing my query, I just added a condition to hide my list of related content only in the editing page.

<?php if (!isset($_GET['elementor-preview'])) : ?>
  // my block that was causing the bug
<?php endif; ?>

@encreinformatique
Copy link

@crtlf in my case, it is not working.
But looking into it, it seems the Js object is missing a looooot of stuff.

I do have :


/* <![CDATA[ */
var elementorFrontendConfig = {
  "isEditMode": "",
  "is_rtl": "",
  "urls": {
    "assets": "https:\/\/www.domain.com\/wp-content\/plugins\/elementor\/assets\/"
  },
  "settings": {
    "page": [],
    "general": {
      "elementor_global_image_lightbox": "yes",
      "elementor_enable_lightbox_in_editor": "yes"
    }
  },
  "post": {
    "id": 771,
    "title": "Title of my post",
    "excerpt": ""
  }
};
/* ]]> */

In another website where it is working :

/* <![CDATA[ */
var elementorFrontendConfig = {
  "isEditMode": "1",
  "is_rtl": "",
  "urls": {
    "assets": "http:\/\/www.another.com\/wp-content\/plugins\/elementor\/assets\/"
  },
  "settings": {
    "page": [],
    "general": {
      "elementor_global_image_lightbox": "yes",
      "elementor_enable_lightbox_in_editor": "yes"
    }
  },
  "post": {
    "id": 82,
    "title": "Elementor #82",
    "excerpt": ""
  },
  "elements": {
    "data": {},
    "editSettings": {},
    "keys": {
    [...]

In the working one, there is the elements node with the data object.
That's weird it is not appearing in the not working one.

@encreinformatique
Copy link

I found out what was wrong in my case. The elementor-preview into the url seems to be the revision Id and not the post id.

Therefore, the is_preview_mode method is not working as intented.
File : https://github.com/pojome/elementor/blob/v2.0.16/includes/preview.php

	/**
	 * Whether preview mode is active.
	 *
	 * Used to determine whether we are in the preview mode (iframe).
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @param int $post_id Optional. Post ID. Default is `0`.
	 *
	 * @return bool Whether preview mode is active.
	 */
	public function is_preview_mode( $post_id = 0 ) {
		if ( empty( $post_id ) ) {
			$post_id = get_the_ID();
		}

		if ( ! User::is_current_user_can_edit( $post_id ) ) {
			return false;
		}

		if ( ! isset( $_GET['elementor-preview'] )  ) {
			/*
			 * Working if not checkig the ID itself.
			 * Don't use it, security issue.
			 */
			//|| $post_id !== (int) $_GET['elementor-preview']
			return false;
		}

		return true;
	}

@crtlf
Copy link

crtlf commented Jun 15, 2018

I didn't know this function, it can be useful.

If it's not working, you can use my ugly workaround. Because if you check the current URL, even if you are in the editing mode, it will return your content URL and not the wp-admin/... URL. The only difference I've found is the elementor-preview URL parameter.

if (!isset($_GET['elementor-preview'])) {
  // your stuff that breaks Elementor
}

@encreinformatique
Copy link

@crtlf I did try your solution but it was not working. That is why I went a little further and found out the function. I modified it as above to make it work. But it can hardly recommend it as it removes the security about modifying a post that is not the correct one.

@masikhsanms
Copy link

masikhsanms commented Jul 11, 2018

@KingYes when editing a page using the elementor on the learndash plugin the lessons menu part I can not edit the post and get an error like the picture.
but in the course menu to edit the page runs.
capture

@Appsbender
Copy link

@masikhsanms , I'd run through the same error. It turns out that it's my Nginx configurations that need to be fixed. Here's my config :

try_files $uri $uri/ /index.php?$args;

and replaced with

try_files $uri $uri/ /index.php?q=$uri&$args;

and restart your server. Hope that helps.

@azurramas
Copy link

azurramas commented Jun 14, 2020

@masikhsanms , I'd run through the same error. It turns out that it's my Nginx configurations that need to be fixed. Here's my config :

try_files $uri $uri/ /index.php?$args;

and replaced with

try_files $uri $uri/ /index.php?q=$uri&$args;

and restart your server. Hope that helps.

Just to confirm that this fixed my issue, thanks alot. I would advise all Nginx users to try this method.

@pobon-xs
Copy link

http://prntscr.com/u6sbuo
@KingYes the issues is still present in elementor v-3.0.2

@Estuardo666
Copy link

http://prntscr.com/u6sbuo
@KingYes the issues is still present in elementor v-3.0.2

I have same issue, I can't edit at all

@Estuardo666
Copy link

I’ve the same problem since I’ve made the upgrade.
I do what some user has said: edit each page, make preview, click edit with elementor and all works again!

I'm not a developer, But it would be great if the bug can be rectified on a Litespeed server.

@Estuardo666
Copy link

I’ve the same problem since I’ve made the upgrade.
I do what some user has said: edit each page, make preview, click edit with elementor and all works again!

I'm not a developer, But it would be great if the bug can be rectified on a Litespeed server.

Permalink: SIMPLE

@dghein
Copy link

dghein commented Oct 27, 2020

I found out what was wrong in my case. The elementor-preview into the url seems to be the revision Id and not the post id.

Therefore, the is_preview_mode method is not working as intented.
File : https://github.com/pojome/elementor/blob/v2.0.16/includes/preview.php

	/**
	 * Whether preview mode is active.
	 *
	 * Used to determine whether we are in the preview mode (iframe).
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @param int $post_id Optional. Post ID. Default is `0`.
	 *
	 * @return bool Whether preview mode is active.
	 */
	public function is_preview_mode( $post_id = 0 ) {
		if ( empty( $post_id ) ) {
			$post_id = get_the_ID();
		}

		if ( ! User::is_current_user_can_edit( $post_id ) ) {
			return false;
		}

		if ( ! isset( $_GET['elementor-preview'] )  ) {
			/*
			 * Working if not checkig the ID itself.
			 * Don't use it, security issue.
			 */
			//|| $post_id !== (int) $_GET['elementor-preview']
			return false;
		}

		return true;
	}

why does this solution work for me? i assume it has something to do with cloudfront and the check for a GET parameter? Should I adjust cloudfront distribution settings to account for this? If I disable cloudfront altogether, this is no longer a problem. But keeping CF in place and forcing this function to return true appears to resolve the issue. I'd rather not edit plugin code.

edit: it appears to be related to variables being passed through http headers. allowing this as default behavior in cloudfront has allowed this to work without modifying the plugin code

@saltywd
Copy link

saltywd commented Jul 14, 2022

I am having a problem when trying to edit any page on site, it wont give me anything except a redirect into the footer section of the page, NOT the main page or any other page i am trying to edit with elementor.

JS: 2022-07-12 14:18:01 [error X 3][https://michaelw356.sg-host.com/wp-content/plugins/elementor/assets/js/frontend.min.js:2:30659] elementor.settings.page is undefined

looking at system info within elementor it gives me this error

@phuctrance
Copy link

I found out what was wrong in my case. The elementor-preview into the url seems to be the revision Id and not the post id.
Therefore, the is_preview_mode method is not working as intented.
File : https://github.com/pojome/elementor/blob/v2.0.16/includes/preview.php

	/**
	 * Whether preview mode is active.
	 *
	 * Used to determine whether we are in the preview mode (iframe).
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @param int $post_id Optional. Post ID. Default is `0`.
	 *
	 * @return bool Whether preview mode is active.
	 */
	public function is_preview_mode( $post_id = 0 ) {
		if ( empty( $post_id ) ) {
			$post_id = get_the_ID();
		}

		if ( ! User::is_current_user_can_edit( $post_id ) ) {
			return false;
		}

		if ( ! isset( $_GET['elementor-preview'] )  ) {
			/*
			 * Working if not checkig the ID itself.
			 * Don't use it, security issue.
			 */
			//|| $post_id !== (int) $_GET['elementor-preview']
			return false;
		}

		return true;
	}

why does this solution work for me? i assume it has something to do with cloudfront and the check for a GET parameter? Should I adjust cloudfront distribution settings to account for this? If I disable cloudfront altogether, this is no longer a problem. But keeping CF in place and forcing this function to return true appears to resolve the issue. I'd rather not edit plugin code.

edit: it appears to be related to variables being passed through http headers. allowing this as default behavior in cloudfront has allowed this to work without modifying the plugin code

image

my case, it was the CloudFront cache policy, allow All query strings to include in the cache key makes it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates a bug with one or multiple components.
Projects
None yet
Development

No branches or pull requests