Uncaught Error: Mismatched anonymous define() module in a page with Fabrik form and Widgekit module

Makulia

Member
Hello, Community!

I have faced this strange error linked to require.js library.
Here is the link to the page with this error.

My Spec: J 3.3.3. Latest github fabrik.
I have found similar thread in the Fabrik forums but in my case there is no problem with jQuery in the Firebug!

Please, help with advice! Thank you!

Code from Firebug:
Code:
Error: Mismatched anonymous define() module: function ($){var toFix=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],toBind="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],slice=Array.prototype.slice,nullLowestDeltaTimeout,lowestDelta;if($.event.fixHooks){for(var i=toFix.length;i;){$.event.fixHooks[toFix[--i]]=$.event.mouseHooks}}var special=$.event.special.mousewheel={version:"3.1.11",setup:function(){if(this.addEventListener){for(var i=toBind.length;i;){this.addEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=handler}$.data(this,"mousewheel-line-height",special.getLineHeight(this));$.data(this,"mousewheel-page-height",special.getPageHeight(this))},teardown:function(){if(this.removeEventListener){for(var i=toBind.length;i;){this.removeEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=null}$.removeData(this,"mousewheel-line-height");$.removeData(this,"mousewheel-page-height")},getLineHeight:function(elem){var $parent=$(elem)["offsetParent"in $.fn?"offsetParent":"parent"]();if(!$parent.length){$parent=$("body")}return parseInt($parent.css("fontSize"),10)},getPageHeight:function(elem){return $(elem).height()},settings:{adjustOldDeltas:true,normalizeOffset:true}};$.fn.extend({mousewheel:function(fn){return fn?this.bind("mousewheel",fn):this.trigger("mousewheel")},unmousewheel:function(fn){return this.unbind("mousewheel",fn)}});function handler(event){var orgEvent=event||window.event,args=slice.call(arguments,1),delta=0,deltaX=0,deltaY=0,absDelta=0,offsetX=0,offsetY=0;event=$.event.fix(orgEvent);event.type="mousewheel";if("detail"in orgEvent){deltaY=orgEvent.detail*-1}if("wheelDelta"in orgEvent){deltaY=orgEvent.wheelDelta}if("wheelDeltaY"in orgEvent){deltaY=orgEvent.wheelDeltaY}if("wheelDeltaX"in orgEvent){deltaX=orgEvent.wheelDeltaX*-1}if("axis"in orgEvent&&orgEvent.axis===orgEvent.HORIZONTAL_AXIS){deltaX=deltaY*-1;deltaY=0}delta=deltaY===0?deltaX:deltaY;if("deltaY"in orgEvent){deltaY=orgEvent.deltaY*-1;delta=deltaY}if("deltaX"in orgEvent){deltaX=orgEvent.deltaX;if(deltaY===0){delta=deltaX*-1}}if(deltaY===0&&deltaX===0){return}if(orgEvent.deltaMode===1){var lineHeight=$.data(this,"mousewheel-line-height");delta*=lineHeight;deltaY*=lineHeight;deltaX*=lineHeight}else if(orgEvent.deltaMode===2){var pageHeight=$.data(this,"mousewheel-page-height");delta*=pageHeight;deltaY*=pageHeight;deltaX*=pageHeight}absDelta=Math.max(Math.abs(deltaY),Math.abs(deltaX));if(!lowestDelta||absDelta<lowestDelta){lowestDelta=absDelta;if(shouldAdjustOldDeltas(orgEvent,absDelta)){lowestDelta/=40}}if(shouldAdjustOldDeltas(orgEvent,absDelta)){delta/=40;deltaX/=40;deltaY/=40}delta=Math[delta>=1?"floor":"ceil"](delta/lowestDelta);deltaX=Math[deltaX>=1?"floor":"ceil"](deltaX/lowestDelta);deltaY=Math[deltaY>=1?"floor":"ceil"](deltaY/lowestDelta);if(special.settings.normalizeOffset&&this.getBoundingClientRect){var boundingRect=this.getBoundingClientRect();offsetX=event.clientX-boundingRect.left;offsetY=event.clientY-boundingRect.top}event.deltaX=deltaX;event.deltaY=deltaY;event.deltaFactor=lowestDelta;event.offsetX=offsetX;event.offsetY=offsetY;event.deltaMode=0;args.unshift(event,delta,deltaX,deltaY);if(nullLowestDeltaTimeout){clearTimeout(nullLowestDeltaTimeout)}nullLowestDeltaTimeout=setTimeout(nullLowestDelta,200);return($.event.dispatch||$.event.handle).apply(this,args)}function nullLowestDelta(){lowestDelta=null}function shouldAdjustOldDeltas(orgEvent,absDelta){return special.settings.adjustOldDeltas&&orgEvent.type==="mousewheel"&&absDelta%120===0}} http://requirejs.org/docs/errors.html#mismatch
...){c=c[b]});return c}function C(b,c,d,g){c=Error(c+"\nhttp://requirejs.org/docs/e...
 
I have found cause of this problem. It is the JS scripts load order!
To make this work we should change the JS scripts loading order so that widgetkit-{some-value}.js is loaded before require.js, not after!
 
Old thread but what exactly did you change to fix this? Changing the plugin order does not help.

On Github I see a widgetkit fix but even with the latest Github files I cannot enable the widgetkit.
 
Can you point me at the commit with the widgetkit fix? I'm not sure of that would have been for this issue, or something else.

Also, can you point me at the widgetkit plugin you are using so I can download it and test? There are several,

-- hugh
 
Ah, that branch shouldn't be there, I think one of us accidentally re-created it recently. That was one of our attempts to see if we could get requirejs always loading last.

Checking to see if we did get that working ...

-- hugh
 
OK, I've installed widgetkit here, and applied the changes form that branch, slightly modified to account for other changes made since then ... and it seems to be working.

Not exactly the cleanest way of doing it, but it works.

I'll have to run it for the rest of the day locally, before I commit, make sure there's no hidden gotchas.

-- hugh
 
Turns out the fix is not as easy as I thought, I found several instances where our code just won't run, with the approach that widgetkitfix branch was using.

It's going to take some more work to get it right.

-- hugh
 
It's one of those things we would like to solve, but it's going to take someone funding it, we just don't have the time to work on it without funding, as it affects so few people.

The problem is that widgetkit uses a plugin running on the very last hook Joomla calls, to insert their JS. And even if we use that same hook in our system plugin, we will typically run before them, unless the admin manually edits the extensions table to set our 'order'. But then we'd wind up back conflicting with things like Kunena, as our plugin ordering needs to come before several commone extensions, for other gory reasons.

That branch I looked at tried to solve it by inserting the call to load requirejs at the end of the BODY, rather than in the HEAD where such things should really be, and where we already insert the requirejs init code. And at first I though that was working, but it only works half the time, in certain usage cases.

So I think we'd have to add another system plugin, which could be configured separately to our main system plugin, forced to run after widgetkit.

The only other option would be to talk to the widgitkit authors, and see if we could work out some mutual compromise. Like we both autodetect the presence of the other, and if we see widgit kit is present, we don't insert the requirejs load call, we leave it to them, and they can insert it in their plugin hook, if they detect that we are loaded.

Or we could tweak your copy of the widgitkit code to do it. :)

-- hugh
 
Hey Guys,

This happened to me mid adding in about 400 records! I rebooted my webserver - nothing. But clearing joomlas cache and purging expired seemed to fix it if that helps anyone

~Jo
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top