Jump to content
We've recently updated our Privacy Statement, available here ×

Mismatched anonymous define() module error when using custom hyperlink handler


ktalarico

Recommended Posts

We are using a custom dashboard hyperlink handler taken from here:  https://community.jaspersoft.com/wiki/how-use-custom-hyperlink-handler-dashboard-tibco-jasperreports-server

After upgrading to 7.2, we are getting the following error in the browser console and the dashboard fails to load:

Error: Mismatched anonymous define() module: function(require)

I have consulted https://requirejs.org/docs/errors.html#mismatch and I feel like I followed the solution but it did not help.

The problem seems to be related to the order in which javascript modules are being loaded.

The error does not happen consistently.  I can execute dashboards several times in a row without error before it happens.

I understand that RequireJS is a JavaScript file and module loader, but I know very little about javascript; so any suggestions for the layperson are welcome.

The custom handler code is below.

//define(function(require) {define(["require","jquery", "underscore"], function(require) {    "use strict";     var $ = require("jquery"),        _ = require("underscore");     return {        events: {            click: function(event, linkData) {                if (window.location.href.indexOf("dashboard/viewer") > -1) {                    var hashParts = window.location.hash.split("&"),                        reportUri = hashParts[0],                        params = {};                     for (var i = 1; i < hashParts.length; i++) {                        if (hashParts[i].indexOf("=") > 0) {                            var key = hashParts[i].split("=")[0],                                value = hashParts[i].split("=")[1];                             if (key in params) {                                params[key].push(value);                            } else {                                params[key] = [value];                            }                        }                    }                    location.replace(reportUri + "&" + $.param(_.extend(params, linkData.parameters), true));                }            }        }    }});

 

Link to comment
Share on other sites

  • 3 months later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Solution provided by Tibco support:

Our engineering team investigated this and says that the issue seems to be caused by some strange behavior in require.js.  They say that the issue can be fixed by adding the module name in dashboardHyperlinkHandlerUpdateDashboardParams.js like this: replace define(function(require) {with define("dashboardHyperlinkHandlerUpdateDashboardParams", function(require) {

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...