Completely handle Data Refreshing on client-side using TRPCs setData()
Hello Guys,
I am currently developing a side project where users can set up Contacts, Projects and Tasks which can then be linked together.
Now, all three have their own page and Data Table. There is also a Dashboard where I fetch all the data to show some graphs etc.
What I am doing right now is to fetch all entries of the user and cache it for an hour. Then, when a user creates, makes changes or deletes an entry, it is updated in the related entries as well. (pushed, updated, removed) So I fetch all the entries at the start of the user's session and later just refresh it client-side.
As I am building some subpages for e.g. a specific project entry, I noticed that the structure might not be as smooth as I thought. For example, when I want to get all the tasks for a specific projects, i grab all the tasks (which are cached and thus avoid a refetch) and filter out these with the specific project id.
Is this the right approach I am doing? Should I go to traditionally re-fetching and invalidating the data as soon as something has changed? My thought is that if you e.g. edit a task which is related to a project, I don't like the idea of refetching the whole project table in order to display the changes
0 Replies