qlik-demo-team / qdt-components

React Components to be used with Angular 10, React 16 and Vue 2. Connects with the Capability API and Engine API.
MIT License
92 stars 50 forks source link

Error when try to get qdt component of type "extension". #197

Closed fchubu closed 4 years ago

fchubu commented 4 years ago

Info:

Behaviour only when try to get components of type 'extension'.

The library is trying to get a file extension ".css.js"

Code:

const viz1 = {
      type: 'QdtViz',
      props: {
        type: 'extension', 
        id: 'a5e0f12c-38f5-4da9-8f3f-0e4566b28398', 
        height: '300px' 
      }
}

<QdtComponent type={viz1.type} props={viz1.props} />

Console output:

error error2
fkabinoff commented 4 years ago

This has to do with the require.js text plugin that many qlik sense extensions make use of, thats bundled along with the require.js code qlik sense uses both in the client and in the capability apis.

You can check out the text plugin docs for more info here, https://github.com/requirejs/text, but basically if the text plugin is used to make a request to a file cross origin, it tries to load a .js file instead unless you set a requirejs config value useXhr to true. We have that set in the qApp.js file in qdt-components, and this has worked previously. However I can confirm that it's no longer working. This is something that has changed with the require.js code that is loaded from Qlik Sense itself, and I'm at a loss how to address it.

This is not a problem with qdt-components, but with building any mashup using the capability apis on a different origin than your qlik sense enterprise origin.

You can fix this for this particular extension, however. the qlik sense require.js stuff also includes the css plugin, which is working fine. So if you go into the SimpleFieldSelect.js file, and in the define props, change all the text! to css! it will fix this particular issue for you. Screenshot below

image

fchubu commented 4 years ago

Hi @fkabinoff , thanks for the rensponse/info.