posva / pinia-colada

🍹 The smart data fetching layer for Pinia
https://pinia-colada.esm.dev/
MIT License
761 stars 10 forks source link

feat: add gcTime #29

Closed ElisePatrikainen closed 5 months ago

netlify[bot] commented 5 months ago

Deploy Preview for funny-banoffee-0afb46 canceled.

Name Link
Latest commit c1b730ff89f51c9f8602792490d0060b1ae945f0
Latest deploy log https://app.netlify.com/sites/funny-banoffee-0afb46/deploys/6621c5356aec800008e04934
ElisePatrikainen commented 5 months ago

@posva I initially thought of tracking the instances where queries are used, and triggering the gc timeout when all instances are unmounted (ie when the query becomes inactive) but I didn’t find a way to track it. Therefore, as a first step, I am triggering it at each fetch (which, I think, could at least cover a consistent part of the cases, because it seems quite likely that, in the case of an active query, it would be refetch before the completion of the gcTime).