<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Require.js error in react mashup in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-error-in-react-mashup/m-p/1963994#M17146</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/191669"&gt;@batra_vivek&lt;/a&gt;&amp;nbsp; As you said when you created test app with create-react-app, it was working fine right?&lt;/P&gt;
&lt;P&gt;But when you implement in existing react web app. It doesn't work.&amp;nbsp; I assumed you must have other js projects files in that web page where you are loading charts. See to it that you load qlik require.js file at last.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for eg. if web page has cdns like popper.js , jqurey.js , require.js and your main.js files. Then&amp;nbsp; first load popper.js and jqurey.js and at last load require.js and then load your mashup file main.js.&lt;/P&gt;
&lt;P&gt;sometimes require.js gets&amp;nbsp;conflicted with other js files as it has &lt;SPAN&gt;&amp;nbsp;anonymous define&amp;nbsp;function. I am only guessing as I don't&amp;nbsp;know your whole web app code.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Aug 2022 11:37:59 GMT</pubDate>
    <dc:creator>vighneshg</dc:creator>
    <dc:date>2022-08-03T11:37:59Z</dc:date>
    <item>
      <title>Require.js error in react mashup</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-error-in-react-mashup/m-p/1961619#M17103</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I am using mashup to integrate Qlik Sense SaaS in my react based web application. I am able to open the app and get hold of the visualization object as well. But when it comes to rendering, only the Visualization title is rendered not the actual chart data, even though that the visulization object has the data. I get the below errors in conolse.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="batra_vivek_0-1659001023231.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/85366i2A34EDF0AA7738DD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="batra_vivek_0-1659001023231.png" alt="batra_vivek_0-1659001023231.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have also added my localhost:3333 to the white list while creating the&amp;nbsp; Web Integration in Console in my tennant.&lt;/P&gt;
&lt;P&gt;Hope to get a solution as this has been bothering me from quite some time now.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Vivek&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 09:37:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-error-in-react-mashup/m-p/1961619#M17103</guid>
      <dc:creator>batra_vivek</dc:creator>
      <dc:date>2022-07-28T09:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: Require.js error in react mashup</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-error-in-react-mashup/m-p/1961628#M17104</link>
      <description>&lt;P&gt;Hey there&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/191669"&gt;@batra_vivek&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Could you try to host your page on HTTPS instead of HTTP?&lt;BR /&gt;In the past I saw a similar error, due to this&lt;BR /&gt;&lt;BR /&gt;I hope this helps,&lt;BR /&gt;Riccardo&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 09:21:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-error-in-react-mashup/m-p/1961628#M17104</guid>
      <dc:creator>rzenere_avvale</dc:creator>
      <dc:date>2022-07-28T09:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: Require.js error in react mashup</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-error-in-react-mashup/m-p/1961634#M17105</link>
      <description>&lt;P&gt;More puzzeling for me is, I created a new react app with create-react-app which is again running on "HTTP"&amp;nbsp;&amp;nbsp;&lt;A href="http://localhost:3000" target="_blank" rel="noopener"&gt;http://localhost:3000&lt;/A&gt;&amp;nbsp;and the charts are loading fine.&lt;/P&gt;
&lt;P&gt;With that working in a bare web app, I am trying to integrate the charts in my existing react web app and then it refuses to work even though the console errors are same in both the cases.&lt;/P&gt;
&lt;P&gt;No idea how to troubleshoot it.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 10:04:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-error-in-react-mashup/m-p/1961634#M17105</guid>
      <dc:creator>batra_vivek</dc:creator>
      <dc:date>2022-07-28T10:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: Require.js error in react mashup</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-error-in-react-mashup/m-p/1963994#M17146</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/191669"&gt;@batra_vivek&lt;/a&gt;&amp;nbsp; As you said when you created test app with create-react-app, it was working fine right?&lt;/P&gt;
&lt;P&gt;But when you implement in existing react web app. It doesn't work.&amp;nbsp; I assumed you must have other js projects files in that web page where you are loading charts. See to it that you load qlik require.js file at last.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for eg. if web page has cdns like popper.js , jqurey.js , require.js and your main.js files. Then&amp;nbsp; first load popper.js and jqurey.js and at last load require.js and then load your mashup file main.js.&lt;/P&gt;
&lt;P&gt;sometimes require.js gets&amp;nbsp;conflicted with other js files as it has &lt;SPAN&gt;&amp;nbsp;anonymous define&amp;nbsp;function. I am only guessing as I don't&amp;nbsp;know your whole web app code.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 11:37:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-error-in-react-mashup/m-p/1963994#M17146</guid>
      <dc:creator>vighneshg</dc:creator>
      <dc:date>2022-08-03T11:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: Require.js error in react mashup</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-error-in-react-mashup/m-p/1964921#M17156</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/190834"&gt;@vighneshg&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your message. I am posting my code below. I think I am doing the way as you suggested.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;

&amp;lt;head&amp;gt;
  &amp;lt;!-- Version {!major!}.{!minor!}.{!maintenance!}.{!build!} --&amp;gt;
  &amp;lt;title&amp;gt;Daleel Smart Portal&amp;lt;/title&amp;gt;
  &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge" /&amp;gt;
  &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&amp;gt;
  &amp;lt;link type="text/css" rel="stylesheet" href="/css/materialize.css" media="screen,projection" /&amp;gt;
  &amp;lt;link type="text/css" rel="stylesheet" href="/css/materialize.extensions.css" media="screen,projection" /&amp;gt;
  &amp;lt;link type="text/css" rel="stylesheet" href="/css/materialize.icons.css" media="screen,projection" /&amp;gt;
  &amp;lt;link type="text/css" rel="stylesheet" href="/css/bootstrap-datetimepicker-standalone-4.17.45.css"
    media="screen,projection" /&amp;gt;
  &amp;lt;link type="text/css" rel="stylesheet" href="/css/bootstrap-datetimepicker.css" media="screen,projection" /&amp;gt;
  &amp;lt;lin type="text/css" rel="stylesheet"
    href="https://5mgt7zl1n5abmk4.sg.qlikcloud.com/resources/autogenerated/qlik-styles.css" media="screen,projection" /&amp;gt;
  &amp;lt;script type="text/javascript" src="/vendor.js"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;script type="text/javascript" src="/app.js"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;script type="text/javascript"&amp;gt;
    var React = require('react');
    var ReactDOM = require('react-dom');
    var indexPage = require('pages/index').default;
    document.addEventListener('DOMContentLoaded', function () {
      ReactDOM.render(React.createElement(indexPage, {}), document.querySelector('#indexContainer'));
    });
  &amp;lt;/script&amp;gt;

  &amp;lt;script type="text/javascript"
    src="https://5mgt7zl1n5abmk4.sg.qlikcloud.com/resources/assets/external/requirejs/require.js"&amp;gt;&amp;lt;/script&amp;gt;


&amp;lt;/head&amp;gt;

&amp;lt;body style="background-color: #e3f2fd;"&amp;gt;
  &amp;lt;div id="indexContainer"&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;import React from 'react';
import * as Config from 'utils/configuration';
import * as Actions from 'data/qlik/actions';


export default class QlikConnection extends React.Component {

  constructor(props) {
    super(props);
    this.state = {};
  }

  componentDidMount() {
    this.openQlikConnection();
  }

  openQlikConnection() {
    var me = this;
    var config = {
      host: Config.HOST,
      prefix: Config.PREFIX,
      port: Config.PORT,
      isSecure: Config.IS_SECURE
    };
    requirejs.config({
      baseUrl: Actions.baseUrl() + '/resources',
      webIntegrationId: Config.WEB_INTEGRATION_ID
    });

    requirejs(["js/qlik"], function (qlik) {
      qlik.setOnError(function (error) {
        me.props.callback({ errorMessage: 'Error on loading QVF from Qlik ' + error, app: null });
        console.log(error);
      });

      var app = qlik.openApp(Config.APP_ID, config);
      var state = { errorMessage: null };
      state[me.props.appName] = app;
      me.props.callback(state);
    });
  }

  render() {
    return &amp;lt;span /&amp;gt;;
  }
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;export default class QlikObject extends React.Component {

	constructor(props) {
		super(props);
		this.state = {};
	}

	componentDidMount() {
		this.getObject();
	}

	shouldComponentUpdate(nextProps) {
		return this.props.qlikId != nextProps.qlikId;
	}

	getObject() {
		var that = this;
		//this.props.app.getObject(this.props.chartId, this.props.qlikId).then(model =&amp;gt; { that.setState({ model: model }) });
		this.props.app.visualization.get(this.props.qlikId).then(v =&amp;gt; { v.show(this.props.chartId) });
	}

	componentDidUpdate() {
		if (this.state.model) {
			this.state.model.close();
		}
		this.getObject();
	}

	componentWillUnmount() {
		if (this.state.model) {
			this.state.model.close();
		}
	}

	render() {
		return &amp;lt;div style={{ height: 300, width: 700 }} id={this.props.chartId} /&amp;gt;;
	}
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;I have removed all the other js files that I was loading but still the issue persists.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 05:06:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Require-js-error-in-react-mashup/m-p/1964921#M17156</guid>
      <dc:creator>vivek_batra</dc:creator>
      <dc:date>2022-08-05T05:06:05Z</dc:date>
    </item>
  </channel>
</rss>

