Replies: 2 comments 3 replies
-
|
I think you are looking for this: https://pinia-colada.esm.dev/cookbook/prefetching.html#Thanks-to-defineQueryOptions |
Beta Was this translation helpful? Give feedback.
-
|
The docs say that this is for when you do not have dynamic keys, I do. Different pages have different dynamic keys included in their parameters; So would that not be an incorrect use case here? If it can't take dynamic keys, You would still need to manually manage a cache of them yourself still, no? I'm also not looking to prefetch, I actually want the opposite. I want to essentially postfetch. This also seems like a lot of manual boilerplate for something that should be relatively simple but just unimplemented in the library (similar to removing cache items...) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello! This is a bit crazy maybe but I'd love some insight.
I'd like a way to use a call to
useQuerythat does not re-fetch data if it isinactiveunder the hood or is some new instance ofuseQuery(I think my problem is that it's inactive?) I'd really like to be able to call auseQueryFactory(myParams).refresh()as needed and have it return the cached data if it's available without relying on reactivity.I know that
defineQueryexists and it is a great solution for most cases, but in my case I'm running into issues using it as well. In my scenario I'm using the sameuseQuerywith different parameters multiple times in the same page... When I do this, the data loses its observers. With no observers, or because it's technically a new instance ofuseQuerythe data is being refetched when.refresh()is called. That would normally be fine because of the existence ofdefineQuerybut in my casedefineQuerywould cause the other sections relying on the same instance ofuseQueryto also update to the newly provided parameters.I feel like I'm probably misunderstanding something at a base level as it seems counter intuitive to me that different instances of
useQuerywith the same parameters result in a fresh fetch every timeShould I just be trying to access the cache directly? via
useQueryCacheor am I expected to build some kind of wrapper around everything that attempts to cache pinia-colada itself or am I just stupid and should move on to some other library that does what I want instead / write one myselfBeta Was this translation helpful? Give feedback.
All reactions