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

Every 3rd-5th edit page load, javascript is not initialised and widgets don't appear in debug mode #156

Open
fredvd opened this issue May 17, 2017 · 5 comments

Comments

@fredvd
Copy link
Member

fredvd commented May 17, 2017

Using Plone 4.3.14, testing p.a.widgets 1.91. Created a site, installed p.a.widgets in the control panel.

Randomly the following error is shown in the browser console, which disables all widgets richtext-area's, the formtabs for categorisation, etc. from being initialised:

widgets.js:168 Uncaught Error: Mismatched anonymous define() module: function ($) {
"use strict";

.... .....

http://requirejs.org/docs/errors.html#mismatch
at makeError (http://localhost:8080/Plone/portal_javascripts/Sunburst%20Theme/++resource++plone.app.widgets.js:1:1396)
at intakeDefines (http://localhost:8080/Plone/portal_javascripts/Sunburst%20Theme/++resource++plone.app.widgets.js:1:7745)
at http://localhost:8080/Plone/portal_javascripts/Sunburst%20Theme/++resource++plone.app.widgets.js:1:16557

@fredvd
Copy link
Member Author

fredvd commented May 17, 2017

Did some more checks:

  • the error * is visible in the console on loading all pages, not just the edit page, so the error might not be related to the widgets not initialising.
  • My first tests were when running in debug mode. if I turn debug mode off, the error is still displayed on every page, but the javascript is now always initialised correctly

(* The listed error is explained here: https://docs.plone.org/adapt-and-extend/theming/resourceregistry.html#the-mismatched-anonymous-define-error . So there's probably a mismatch between the p.a.widgets code using requireJS but inserted using normal javascript tags, but I have no idea how to fix this.

@fredvd fredvd changed the title Every 3rd-5th edit page load, javascript is not initialised and widgets don't appear Every 3rd-5th edit page load, javascript is not initialised and widgets don't appear in debug mode May 17, 2017
@holdenhao
Copy link

Your issue may be related to a bug in plone.app.jquerytools.form.js that I reported for plone.app.jquerytools.

@fredvd
Copy link
Member Author

fredvd commented Jul 31, 2017

@holdenhao You might want to test plone.app.widgets directly from the 1.x branch on github and not the released 1.9.x versions on pypi. @thet and @petschki did some work this June in #167 and #168 to avoid collissions between old style javascripts and require.js . That's what's causing the mismatched anonymous defined error and I think also closes this issue.

The 1.x branch now has AFAIK very reliable TinyMCE loading also in development mode, I wasn't able to trigger an empty textarea while testing.

We might need a new 1.9.x release not to disappoint others testing p.a.widgets 1.x in Plone 4, this looks very promising now.

@holdenhao
Copy link

Thank you for letting me know. I will test from source. My temporary fix was to use version 1.9.0 of plone.app.jquerytools

@fredvd
Copy link
Member Author

fredvd commented Jul 31, 2017

@holdenhao You might by onto some other issue as well, because after plone.app.jquerytools 1.9.0 jquery.form and jquery.tools were updated in this commit. plone/plone.app.jquerytools@d1327d3

If you check the commit you'll see that 'support for AMD' was added in jquery.form, that could collide with the javascript loading of plone.app.widgets. Unfortunately I'm just starting with all this magical javascript bundling in the front end, so much of my debugging efforts go like "if there's smoke, there must be a fire" :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants