Mobile Best Practice for Data Design

I have more of a general question about best practice for the design of a mobile app, especially now its multipage. My team typically work in poor network speed environments so am trying to optimise for that.

I have a typical setup of listview, detailview, editview for multiple tables. How would you set up this within the querys required. I am querying a pgres db.
My current workflow is -

ListView - getAllAssets
DetailView - getAsset
EditView Submit - updateAsset, getAsset, getAllAssets

Pros - After edit, the detail screen only relies on the query returning data for one asset to update. Feeling snappier.

Cons - Opening up the DetailView from the ListView requires a new query response. DetailView and ListView can get out of sync therefore required both queries to be called.

I have thought about

ListView - getAllAssets
DetailView - getAllAssets.filter
EditView Submit - updateAsset, getAllAssets

Whilst not querying the single asset, this does require the larger dataset to be requeried.

I have also thought about

ListView - getAllAssets
DetailView - selectedAssetVariable
EditView Submit - updateAsset getAllAssets, selectedAssetVariable.setValue with form data but havent fleshed that out yet.

1 Like

Hi @Kaman_Doyle,

Thanks for reaching out; great question!

Since you already need to query getAllAssets, it sounds like it is worth trying the variable option that you mentioned! Tracking the variable should ensure the list and detail view are in sync. If you create a new blank multipage mobile app, you should see an example of this.

selectedAssetVariable will be a global variable that you reset on press:

When you update the asset, you'll also update the variable.

Hey Tess,

Thanks for the reply. What would be your recommended flow if you go into the details view, then edit view, then update the record?

the selectedAsset variable is then stale, how would you refresh it?

Kaman

You could have an event handler on success of your update query that also sets the variable: