Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Unanswered

PCF Component not Loading in First Attempt (updateView() isn't triggering)

(0) ShareShare
ReportReport
Posted on by 21

Dear Community,

I am using a Code Component in PowerApps which is developed using PowerApps Component Framework (PCF) to embed Power BI report. By default PCF provides the following methods which automatically get invoked when interacting through PowerApp:

  1. init()
  2. updateView()
  3. getOutputs()
  4. destroy()

Now, I have different Report tiles in my PowerApp. So, when user click on a particular tile, the Report Metadata is passed to PCF component based on which report is loaded.

 

But in the FIRST attempt, reports failed to load (updateView() in PCF Component is not called). But for all subsequent times, reports get loaded as expected (updateView() in PCF component called).

 

Can someone give an idea/ suggestion/ workaround/ different Approaches to address this issue?

 

Thanks.

  • surya_kiran Profile Picture
    21 on at
    Re: PCF Component not Loading in First Attempt (updateView() isn't triggering)

    Hi @Anonymous.. I understand that you are trying to load a dataset when updateView() is getting called.. Yea this could be called multiple times and your dataset might still be loading which might possibly through an error. 

     

    But in my case, I am not using any dataset load operation.. nor i have used any "async" in my code. Problem for me is "updateView()" itself isn't getting called in the first load. And for all subsequent loads, updateView() called 4 times as you have said and everything works fine. Do you have any idea why updateView() isn't triggered? or can you suggest any alternate ways to resolve this issue..

    Thanks, Surya

  • surya_kiran Profile Picture
    21 on at
    Re: PCF Component not Loading in First Attempt (updateView() isn't triggering)

    Hi @cchannon. My PCF component hits init() everytime i load it. But it doesn't call updateView() even once during the first load. I have tried firing updateView() manually in init() and it called the updateView too.. but i couldn't embed report by manually triggering it. In Test Environment everything works fine. 

    I am suspecting that updateView() must be triggered in-order for the PCF control to get the latest content through context. But this is not happening in the first load. All subsequent loads, updateView() is called 4 times as you have already mentioned this updateView() executes in a row multiple times at once to reflect the latest values. 

  • Community Power Platform Member Profile Picture
    on at
    Re: PCF Component not Loading in First Attempt (updateView() isn't triggering)

    In my experience, I have faced this error for (at least)two scenarios:

    1. When using dataset type PCF, the dataset may not correct loading at first, if you put some log on update view you will see multiple times of loading, but not always with correct data. The solution is to add some check on update view:

     if (context.parameters.gridDataSet.error) {
    			// console.log("dataset load error, reloading");
    			context.parameters.gridDataSet.refresh();
    			return;
    		}
    		if (context.parameters.gridDataSet.loading) {
    			// console.log("dataset is loading, wait.");
    			return;
    		}

    2. The other time I remember is that some guy used 'async' in init or updateview, which caused the event flow all ruined when control loading. After we removed the async and make init and updateview sync(with promises to render control), the error is gone.

     

    Hope these will help.

  • cchannon Profile Picture
    4,702 Super User 2025 Season 1 on at
    Re: PCF Component not Loading in First Attempt (updateView() isn't triggering)

    OK, so does the same "never hits Init() on the first load" problem also happen in the test environment? I am guessing it doesn't. If you never hit Init() then something must be failing before your PCF tries to load. Is there other script on the page? other PCFs that might be throwing their own errors? Web resources that could be causing problems? 

  • surya_kiran Profile Picture
    21 on at
    Re: PCF Component not Loading in First Attempt (updateView() isn't triggering)

    Hi, Can anyone please help me on this issue i am facing. Any reply would be appreciated. Thanks, Surya

  • surya_kiran Profile Picture
    21 on at
    Re: PCF Component not Loading in First Attempt (updateView() isn't triggering)

    Hi @cchannon I am sure that UpdateView() in PCF isn't getting called not even once in the first attempt when i try to load the screen in the play mode. Why is this happening.. Any idea? 

    In the PowerApps Component Framework Test Environment, even though when I am trying to embed report using the PowerBI functions, it doesn't load. Only when this UpdateView() executes and calls the PowerBI functions, then only report is loaded properly.. Otherwise its showing "Error Loading control"

     

    I have attached how the logs appear in PowerApps Component Framework test environment.. Please find the same. Please suggest some way to overcome this as this is blocking all work we are doing. Also please give us some details if you could join for a quick call to give some approaches/solutions/work-arounds for this problem. Thanks, Surya 

  • surya_kiran Profile Picture
    21 on at
    Re: PCF Component not Loading in First Attempt (updateView() isn't triggering)

    Hi @cchannon 

    From my observation with regards to your previous comments, The initialization (in init() method) is not happening in the first attempt (i.e ReportId, EmbedToken, EmbedUr = Blank()), also UpdateView() isn't triggered in the first attempt. 

    But during the second Attempt, Initialization (through init() method) is happening successfully, UpdateView() is executing 4 times. And everything is working as expected.  

     

    I am using PCF component to embed Power BI Report. So I obtain the report metadata (i.e ReportId, EmbedToken, EmbedUrl, WorkspaceID) and pass this data to my PCF component. PCF component uses the following Power BI functions:

    1. pbi.service.Service(pbi.factories.hpmFactory, pbi.factories.wpmpFactory, pbi.factories.routerFactory)

    2. powerbi.reset(reportContainer)
    3. powerbi.embed(reportContainer, config)
    to embed the report.
     
    Please suggest what might be going wrong here.. We can also have a short call to clarify this issue if you have a different view on this. Thanks
  • cchannon Profile Picture
    4,702 Super User 2025 Season 1 on at
    Re: PCF Component not Loading in First Attempt (updateView() isn't triggering)

    Same Developer Tools window you used for your screenshots below. Go to Sources, find the index.ts file from your PCF, add a breakpoint.

     

    For more info on adding breakpoints and stepping through, I suggest you just internet search "basics of script debugging in {your browser name}"

  • surya_kiran Profile Picture
    21 on at
    Re: PCF Component not Loading in First Attempt (updateView() isn't triggering)

    Can you suggest how to add debugger to check on this.. Or suggest a tool to debug which would serve our usecase..
    Thanks, surya

  • cchannon Profile Picture
    4,702 Super User 2025 Season 1 on at
    Re: PCF Component not Loading in First Attempt (updateView() isn't triggering)

    If updateView never gets called in the first run, do you maybe have some kind of error being thrown during init? Have you tried adding a debugger and walking through to see where the error happens?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 87 Most Valuable Professional

#2
mmbr1606 Profile Picture

mmbr1606 71 Super User 2025 Season 1

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 67 Super User 2025 Season 1

Overall leaderboard