cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SimonTocker
Advocate I
Advocate I

Page Lifecycles

So I have a question about page lifecycle and this article can demonstrate what I mean.
  

https://powerapps.microsoft.com/en-us/blog/performance-considerations-with-powerapps/

 

In Scenario two if the data is already loaded,   you still clearCollect, and save locally,  with the controls bound to the collections you have loaded from cache.

Wont this trigger a Control reload  or a flash of the controls on the screen,    A ClearCollect, will nuke the data, and reload, so is there any information on the Page Lifecycle for Powerapps, and control lifecycle, if there is such a thing,  will a reload trigger be fired, and hopefully its really quick because its from a collection, and not very large .    When might the reload be triggered ?  Is it when the collection is cleared, or is clearcollect a combined operation that only triggers a reload on completion ?

More Complex.

If you have a control that binds to a datasource and filters by "x", and you have a control that binds to a sql datasource and filters by "y".    Does the binding create what I might call a delegate Call so there are essentially two diffent  delegate calls to the database.    They are called on there initial lifecycle init.  Nothing will change, so the two sql calls are done once.

Now complicate that last scenario in both controls the change the binding, to   = ( "X"  && 3rdControl-DropDown.Value)   and the next control to  ( "Y"  && 3rdControl-DropDown.Value) .
So the original init creates two diff sql queries one per control and executes it based on the existing value in the drop down.

When the DropDown Changes, I take it that it fires an change event, that the Item bindings  subscribed to when there binding context was defined, so that they can adapt to the change in teh Context.   Is that how this works ?

So If Im correct in thinking this is how it works,   When I see someone suggest the following.
    Control1.Default = ClearCollect(colDave, filter([dbo.dave], field = "1") )
    Control2.Default = ClearCollect(colDave, filter([dbo.dave], field = "1") )

That will in a page lifecycle create each control and in its init process, nuke the collection and and filter it twice,  
so that bit of code is really dumb ?

Worse still would be 

    Control1.Default = ClearCollect(colDave, filter([dbo.dave], field = "1") )
    Control2.Default = ClearCollect(colDave, filter([dbo.dave], field = "2") )

 

Hope you get the gist of my ramblings here,   Hoping to get a link to an advanced description of page and control lifecycles in powerapps  here if thats how its coded.

2 REPLIES 2
v-xida-msft
Community Support
Community Support

Hi @SimonTocker ,

Thanks for your feedback. Currently, within PowerApps, there is no detailed doc mentioned about the control lifecycle witin PowerApps.

 

If you want to get more details about the control lifecycle witin PowerApps, please submit an assisted support ticket through the following link:

https://powerapps.microsoft.com/en-us/support/pro

 

In addition, the ClearCollect() function is a behavious function, you could not put it within the Default property of a control, you must put it within a Bahaviour property (e.g. OnSelect, OnChange, ...) of a control. The Default property of a control is required to provide a proper value.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I knew someone saying set the value to clear collect was daft 🙂

 

Thats kind of disappointing, even a single diagram for the community would be good here, especially as you have know opened up the components development part, and here there is not much information about lifecycle.

 

Knowing this helps optimisation and I dont think that individuals should have to request pro support on this, it should be being produced as part of the advanced syllabus, especially in light of components development.    This is similar to folks engaging in a support forum and then saying DM me, leaving all other interested parties by the wayside.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,761)