I am using SharePoint. If the data model has not changed, is there ever a need to refresh the data source when using the app? I am not storing any data locally (not using ClearCollect or Collect) so each call will be doing directly to the server. In which case, what is Refresh(sharepointlist) actually doing other than looking for changes to columns.
Even when not using local data the data from a data source is cached locally on the device in places like a Gallery. Refresh(sharepointlist) will look for changes to the data, not changes to the schema. So it is used to make sure that you have the latest data with all the changes submitted by you and any others. Refresh in the data section of the power apps studio isn't the same thing as this function. It will look for changes to the schema of the data source.
No, the only reason to refresh the DataSource in your app is in the scenario where you have other external factors updating the SharePoint list as well (i.e. another app, a flow, or just someone entering information in the list) and you need to have the most current data in your app.
If this is not a factor, then there is no reason to refresh the datasource.
Refresh on a datasource actually simply clears out the session datasource that is in your Cloud session. Then, depending on various factors (app data consumption, advanced settings to govern data, etc.) the cloud session will retrieve information from the real datasource as it needs. This is then available to your app as needed. IN other words, its a collection in the cloud that you then get data from. This is why it is not real-time refreshing to the datasource...it's a static collection. The only way to get it filled with new data (just like a collection) is to refresh it...in the case of the collection, it is a ClearCollect.
As @Pstork1 mentions (and based on your comment about data model changes) none of the above deals with schema changes. If you are concerned over schema changes, then this is something you would be dealing with in the app.
Schema changes to your datasource CAN happen without impacting your app as long as the changes do not change anything that your app is relying on. In other words, if someone adds a choice column to the list, your app will be fine. If someone changes a text column that you are using in the app to a choice column, then things will go wrong and you need to refresh the datasource IN the designer to account for the change (and then all the places that it is used in the app).
I hope this is helpful for you.
So many events that are happening this month - don't miss out!
Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.
Your chance to join an engaging competition of Power Platform enthusiasts.