Best approach to use local storage

I have some server actions that are the same in each subpage. Noticed that in some of the subpages it takes a liitle more to load this data again, since there are other things loading. Should I use ‘local storage’ for these elements that load on every subpage each time?

Thank you

1 Like

Yes you can do that perfectly. Use the State Manager to store the full data in local Storage or Sessions Storage and they just bind and use it from there

Thanks @George , what happens if this data changes on the database?

1 Like

Well when you save new data you have to take care that your cache is refreshed. The local storage has no idea that your data has being changed. So just on save of the updated that re-query your data and store it again in the local storage.

1 Like

Maybe with a cookie or something I could force Appconnect to download new data?

Improved in ver 1.2.0 now

In the server connect component in the app structure you can choose a state manager to cache your query


When using State manager/local with a server connect do i bind elements to the Local storage or the server connect? Because the Local Storage thing only has ‘data’ and not the fields i need.

Do i bind normally to the server connect? and it just caches automatically?

Th local storage works in your browser, it’s not related to the server connect.

I meant for caching purposes. Do i just set Statemanager = localstorage and that’s it, automatic caching? I still bind to the server connect?

Yes, see George's reply:

Thanks. it was when he said " and they just bind and use it from there" that i wasn’t sure if he meant from the serverconnect or from the localstorage.

Great then if caching is automatic then awesome. :slight_smile:


Hello @George,
I’m making an API call which fetch an object including multiple field like text, numbers, arrays etc. On API call I’m storing that json object in a local storage object. Is there a way to access only specific field of that object i-e if the object in local storage is named student which contains response of API including multiple fields student name, age, roll no, reg no, DOB etc. Now how can I access each field separately for displaying it on page. I have tried these: {{}} and {{[“name”]}} but both doesn’t worked.
Will I have to make multiple field in local storage under student object or can I access all the fields without explicitly defining each field. Any suggestions for this?

{{}} is working fine now