System Design · Middle · Question 46 of 75

How do you update the client cache after a mutation so the user sees the changes?

Explanation

Key-based invalidation (invalidateQueries, RTK Query tags) refetches fresh data; if the server returned the updated object, it's written into the cache directly without an extra request. On the Next.js server the equivalent is updateTag/revalidatePath.

Further reading

Problem with a question

System Design · Middle · question 46

Test yourself

Take the System Design · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz