Forum Discussion
Viewing PowerBI embedded in IFrame and the report keeps refreshing every 5 seconds or so
- Anonymous6 years ago
I cant confirm that the same would work in an Angular project... but a React project I have worked on, relied on the component hosting the Embedded Report (IFrame) tracking its own state.
Then, when re-render events occur, the component decides IF the call to embed needs to be made.
By tracking the current report ID/URL and the state of the embedded object (PreLoad/Loading/Rendered) - I could determine if a reload was required. It sounds as though some external events are causing your component to refresh/re-render - and your code is calling back into the embed function - even though it has already completed and doesn't need to be done again.
Wiki page for tracking events is here: https://github.com/microsoft/PowerBI-JavaScript/wiki/Handling-Events
It's difficult to know for sure without seeing the code - but maybe some verbose debugging/console outputs willl help track it down?
I cant confirm that the same would work in an Angular project... but a React project I have worked on, relied on the component hosting the Embedded Report (IFrame) tracking its own state.
Then, when re-render events occur, the component decides IF the call to embed needs to be made.
By tracking the current report ID/URL and the state of the embedded object (PreLoad/Loading/Rendered) - I could determine if a reload was required. It sounds as though some external events are causing your component to refresh/re-render - and your code is calling back into the embed function - even though it has already completed and doesn't need to be done again.
Wiki page for tracking events is here: https://github.com/microsoft/PowerBI-JavaScript/wiki/Handling-Events
It's difficult to know for sure without seeing the code - but maybe some verbose debugging/console outputs willl help track it down?
I think you are exactly right. I think the new signalR events that are occuring in the background of the web app are triggering some onchange events to the IFrame in which I'm showing the PBI embedded reports. I was able to fix this in Angular by using the changeDetection: ChangeDetectionStrategy.OnPush component option and basically ignoring all event changes in the report component that houses the IFrame. I've attached my code in case anyone else runs in to this. Hope it helps someone. I've bolded the code that is relevant to this issue.
- Anonymous6 years agoNot applicable
Excellent - glad you managed to find the fix. 😀