microsoft / PowerBI-visuals-tools

Contains tools for building/packaging Power BI visuals
https://www.powerbi.com
MIT License
334 stars 150 forks source link

Power BI Visual API; update method not called when changing tabs #519

Open NoMathMan opened 2 months ago

NoMathMan commented 2 months ago

When report is opened for a first time, custom visual utilizing Visual API calls Constructor and Update method. However, when changing to another tab returning to original tab, Visual API calls the Constructor of a custom visual, but not the Update method. What is recommended approach to call Update method when changing tabs, or is this not intended behavior? This problem is severe, because not calling Update while instantiating a visual via Constructor method does not expose any properties of that VisualUpdateOptions type has, most importantly the dataViews. The dataViews play critical role in our visual to make attached logic in event listeners’ handlers to work properly.

We implemented workaround to call host’s fetchMoreData method, which works in PowerBI App Service, but not in Power BI Desktop. And I believe this may not be correct, because when switching tabs data updates for normal visuals either way. This explicit call then introduces another call, possibly degrading performance?