[Closed] Cannot read property 'isPreviewMode' of undefined
This support ticket is created 3 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I am trying to:
Edit my pages using Elementor Pro 3.3.4.
Link to a page where the issue can be seen:
(This happens in the backoffice)
I expected to see:
The Elementor Editor where I can edit my page.
Instead, I got:
"Switch to Safe Mode" (Elementor).
After I do this, I can see the page in the Editor, but the Toolset items are gone.
In screenshot you see what the error is.
Hello, I understand you are experiencing a problem when using Toolset and Elementor Pro 3.3.4 together. I did a quick test in my local environment and installed the latest versions of Types, Views, an Elementor Pro. I created a Page and a View, and added the View to my Page in the Elementor builder using a View element. I was able to publish the page and see the View appear on the front-end, and I do not see any errors in the console when editing my design in Elementor (screenshot attached). There must be something specific in your case that is different from my test. Can you try these troubleshooting steps to help narrow down the source of the problem?
- Temporarily deactivate all plugins except Types, Views, Elementor and Elementor Pro. Activate a default theme like Twenty Twenty One, and temporarily deactivate any custom code snippets in Toolset > Settings > Custom Code tab.
- Test the Elementor builder again to see if the JavaScript error can be reproduced.
- If the error cannot be reproduced, please activate the theme, custom code snippets, and other plugins, one by one, testing each time until the error returns. Let me know if you are able to isolate a source of conflict.
- If the error is still seen after disabling the theme, plugins, and snippets, can you tell me if the error was triggered by adding one specific element in the Elementor builder, like one specific View or one specific Toolset shortcode? Is the same error seen when editing other pages, or is it only in this page?
Hey Christian, thank for your support! So I followed the steps you suggested.
The source of conflict seems to be Toolset Views (3.6): I reactivated the plugins one by one, the Elementor Editor kept working, also with Types activated, until finally I activated Views. After activating Views the error reappeared: "Uncaught TypeError: Cannot read property 'isPreviewMode' of undefined".
The error occurs on any page I want to edit (even a fresh new page, without a view in it).
Please advise what to do next.
Okay thank you for the update. Since I was unable to replicate the problem in my own local site, I think it would be best for me to create a clone of your site where I can run additional tests and complete investigation. I would like to install the Duplicator plugin or the All-in-One WP Migration plugin to create that clone. If that is okay with you, please provide login credentials in the private reply fields here and I will get started.
Okay strangely enough, I installed a clone of your site on my local test environment, and the problem does not appear here. That's a bit concerning, because without being able to replicate the problem locally it is quite difficult to debug or investigate. It is possible that your site uses some server-side caching mechanisms like object caching, memcached, or redis? I see settings for Varnish in wp-admin, but even after purging the Varnish cache on the live site the problem still exists. Are you aware of any other server-side caching systems in place? If so, is it possible to purge those cache(s) manually? You may need to speak to your hosting company for confirmation about server-side caching mechanisms other than Varnish, and whether or not it is possible to purge those caches using a built process in wp-admin or in the server control panel.
Hi Christian, I checked with the hosting company. No other caching tools are installed (no Redis, no memcached). Concerning Varnish: a "bypass" has been activated so Varnish does not actually cache the pages.
Can you retry on the live site? See Pages > Marktstudies. If you edit this page with Elementor, you should see the error when inspecting.
Okay thanks for the additional information. I'm a bit stumped here, as I cannot see anything in the site that would indicate why you are now unable to edit anything with the Elementor builder. It seems that the error you mentioned is thrown any time I try to open the Elementor builder, regardless of whether I'm editing a Page or an Elementor template. Turning on "Safe mode" is the only way to work around that.
In a previous comment you described your plugin elimination test:
..."The source of conflict seems to be Toolset Views (3.6): I reactivated the plugins one by one, the Elementor Editor kept working, also with Types activated, until finally I activated Views. After activating Views the error reappeared..."
It sounds like you reactivated all plugins except Views, and things worked as expected. Then you reactivated Views and the problem returned. I would like to know if the problem exists when only Elementor, Elementor Pro, Types, and Views are active, along with. I'm not clear from your comments earlier if you tried that scenario. If you did not try that scenario, it would be important to help us determine if one of the other plugins contributes to the problem when Views is active. Please let me know what you find out.
Is it possible to reinstall Elementor and Elementor Pro on this site, or possibly update to the latest versions? The basic and pro plugins both have updates available.
Hi christian
I tried the scenario you suggested: first I updated Elementor to the latest Pro version, next I deactivated all plugins, except Elementor (and elementor Pro) and Types and Views. Result: Editing with Elementor generates the error.
Next I also deactivated Views. Result: Editing with Elementor works.
Then I reacivated all plugins, except Views. Result: all good.
Finally I reactivated Views. Result: Error again.
See screenshot - maybe this hels to pinpoint the culprit (somewhere in toolset-view.editor.js?)
See screenshot - maybe this hels to pinpoint the culprit (somewhere in toolset-view.editor.js?)
Thanks, the error you are experiencing in this and previous screenshots does not seem to be changing over time, it always points to the same problem. As you can see in the debugger, the problem is that the variable window.toolsetPageBuilderElementorWidgetViewStrings is undefined in the top frame context. If you switch to the elementor-preview-iframe frame context, the same variable is defined as expected. This preview iframe is the context in which I expect to see the variable defined. I'm attaching screenshots so you can see what I am referring to. In other sites where Elementor is working as expected with Types and Views installed, the variable window.toolsetPageBuilderElementorWidgetViewStrings is undefined in the top frame - that is expected, not a problem. The problem is...why is this code triggered in the top frame? I'm a bit stumped.
- Do you have a staging or development environment for this site? If so, does the same problem occur in your other environment?
- Do you have any additional information about the history of this problem? It seems that at some point, the problem did not occur, because you have created designs in the Elementor builder and you have placed Views in those designs using the Views widgets. Did the problem begin when you updated some plugins, when you updated WordPress, when you migrated the site from another domain, or was there some other event that happened recently before the problem began that might indicate a source of the problem?
- Have you tried reinstalling WordPress? We have reinstalled Toolset Types, Toolset Views and Elementor plugins, but the problem remains. You can try reinstalling WordPress from hidden link. Make a backup of the site before you try this, but normally it should not cause any problems. The process only takes a few minutes.
The topic ‘[Closed] Cannot read property 'isPreviewMode' of undefined’ is closed to new replies.