Forum Discussion
PowerBI Visuals API updating issue
- 9 months ago
Hi TheoAu ,
As the Troubleshooting steps didn't helped in solving the issue, I would suggest to raise support ticket using Microsoft's official support ticket channel using below link:
Create a Fabric and Power BI Support Ticket - Power BI | Microsoft Learn
Thank you.
Hi TheoAu ,
You are right - this issue occurs because Power BI reconstructs the visual container when switching pages but doesn’t always trigger update(options).Currently, the VisualUpdateOptions object can’t be recreated manually, but you can cache it from the last valid update() call.Store the options in a class variable (e.g., this.lastOptions) and reuse them when the visual is rebuilt.Use an IntersectionObserver or resize listener in the constructor to detect when the visual becomes visible again.When triggered, re-render your visual using the cached VisualUpdateOptions.This workaround ensures your visual refreshes automatically until Power BI fixes Issue.
Thank you.
Hi,
Thank you for your time.
That could be a good option. However, I currently do not have the possibility to store anything, as all the class objects are cleared when the user switches the page. For example:
- The user refreshes/loads the page: the visual is created, and the update function is called. At this moment, I can store an object containing the VisualUpdateOptions.
(we can see in the screenshot that as the constructor is called and the update() is called at least once, we can thus define the updateOptions object.)
- When the user switches the page, the visual seems to be cleaned up from memory (this is logical, memory optimization, as we do not need the visual for the moment).
=> the updateOptions object is removed.
- When the user comes back to the initial page, the visual is recreated from scratch. Thus, I can't retrieve previous variables.
(we can see in the screenshot that as the constructor is called and the update() not called once, we can't define the updateOptions object.)
Is there any other solution?