This is the site: https://chamuyapp.vercel.app
Right now I am using Apollo client and their cache but my app was caching all the stuff and didn’t throw out any request so modified it to network-only (guess it kills the essence of caching).
Previously I’ve used SWR to fetch my data and it felt quite helpful cause it updated the data only when there were actually a change.
And now I start to think “when or what kind of scenarios would be good for caching?”. Because the last app that I’ve built for example, is a sort of social media, and caching doesn’t feel good (at least in messages, and users to show).
Then, when you think that it should work it doesn’t. I have a state. It is an array of conversation objects. And each conversation has a prop “content”, this is a stringified array, which contains “message objects” (id, senderID, receiverID, content, etc).
All the messages are displayed one below the other, you have the profile image of the sender, and the content of the message. Whenever I send a message, the request is sent, but I update the state locally without refetching.
And when the message object is added to its conversation. Suddenly all the messages reload their images, and it looks awful cause everytime you send a message all the previous images reload. And the same happens when you delete your message… Shouldn’t the images already be kept in memory? Cause looking in the network tab it turns out that the images are arriving again and again.
Any idea about it?