microsoft / powerbi-client-react

Power BI for React which provides components and services to enabling developers to easily embed Power BI reports into their applications.
MIT License
305 stars 96 forks source link

Powerbi-client throw an error #76

Closed zorrolisto closed 3 months ago

zorrolisto commented 2 years ago

image

This error happen when is use the component powerbi-client-react but the user change to another view before it finish to load.
Posted here because powerbi-client don't allow create issues.
This error can be avoid with.

powerbi.js -- line 6061
WindowPostMessageProxy.prototype.sendResponse = function (targetWindow, message, trackingProperties) {          
    this.addTrackingProperties(message, trackingProperties);            
    if (this.logMessages) {             
        console.log(this.name + " Sending response:");              
        console.log(JSON.stringify(message, null, '  '));           
    }        
+    if(targetWindow){
+        targetWindow.postMessage(message, "*");            
+    }          
-    targetWindow.postMessage(message, "*");      
};
bathan commented 1 year ago

This problem still exists. Any hopes to get a fix?

KotanaSai21 commented 1 year ago

Unable to repro. Can you please provide steps to repro this issue.

bathan commented 1 year ago

I've been unable to repro consistently. It's a combination of slow PBI iframe load time+ refresh or navigation events.

raquelcarvalho commented 8 months ago

This problem still exists. Any hopes to get a fix?

KotanaSai21 commented 8 months ago

@raquelcarvalho , This issue has been fixed in version powerbi-client: 2.22.4. It is published as beta version, so try installing the specific powerbi-client version for now.

raquelcarvalho commented 8 months ago

@KotanaSai21 , Thanks! Well, I'm using the lib powerbi-client-react in version 1.4.0, which has the dependency "powerbi-client": "^2.21.1". As the fixed version is in beta, the lastest version is installed, which is 2.22.3 of powerbi-client. So I keep getting the error. How could I overcome this?

raquelcarvalho commented 8 months ago

I got around the problem by using the paths option in the tsconfig.json file:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "powerbi-client": ["node_modules/powerbi-client"]
    }
  }
}

This tells TypeScript to look for powerbi-client in my project's node_modules directory.

KotanaSai21 commented 8 months ago

@raquelcarvalho , If we specify the "powerbi-client":"2.22.4" in our package.json along with powerbi-client-react it should override the version of powerbi-client getting from powerbi-client-react.

It should work, if not try using overrides in package.json.