Let's say I have a database with users, groups and messages at the groups.
And I have 3 views:
Profile view: Where all the details of the user is shown. Groups view: Where all the groups are shown. Group view: Where all the messages are shown.
Now whenever the user goes to a view, the view connects to the database to retrieve the data.
Would it be good practice to save the data to the client when it's retrieved, so when the user switches views after the first time it doesn't need to make contact with the database anymore. Which improves load times for the user and also reduces the work for the database.
And if the data is really big for example the messages, we could only load the last 100.
Or is it better to retrieve the data every time the user switches views?
If it is good practice to save the data on the client, what would be a good way to check whether the data is updated?