Vue Query 05 ⚡ Caching Lifecycle (staleTime vs gcTime) — Mastering freshness, garbage collection, and background refetching
Caching is the most powerful and often the most misunderstood aspect of Vue Query. In a standard data-fetching setup, data is either “present” or “absent.” Vue Query introduces a more nuanced state machine where data can be “fresh,” “stale,” or “inactive.” This lifecycle is governed by two primary settings: staleTime and gcTime (formerly cacheTime). Mastering…