New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a recipe about custom factories for specific needs #350
Comments
I like the idea 💙 But how is it connected with |
I suggest it as Sure, its more about |
So, what this new field should do to |
I think its important to account for this in cache key, bcs it could lead to unnessesary cache hits Bcs when i switching my accounts, and see cached data from previous account it doesnt look right |
So, why you do not want to use smth like this: sample({
clock: switchAccount,
target: purgeCache,
})
cache(query, {
purge: purgeCache
}) https://farfetched.pages.dev/api/operators/cache.html#formulae |
implicitDependencies
option to keepFresh
implicitDependencies
option to cache
Sure u can purge it. And its the only way to deal with this kind of cases My point is — add ability to preserve that cache than your depencenies changing instead of purging that data, and hit it when dependency changed back(if cache exist), so u dont need to load that data again if it still fresh |
So, we talk about something like this? cache(query, {
extraDependencies: [$userStatus]
}) But I still do not understand, how this extra dep can influence the result of the Query if you do not pass it to the Query? const query = createJsonQuery({
request: {
headers: combine($userStatus, ...)
}
}) In this case, $userStatus would be used as dependency for cache key generation automatically. |
Yes, something like that
Another aproach is to pass as parameters, wrapping
|
I spend some time digging codebase, and from that i could tell, i easier to add Also it should be easy to propagate this param to So it seems that this issue should be renamed to What u think about that? |
I'll think about this case. |
I believe, you can achieve this behavior with custom factory with passing your extraDepa to sourced of createHeadlessQuery. Does it work for you? |
Yes, this is implementation to which i come trying to bring this feature in But it( |
So, just write createNazarQuery in your own code and use it everywhere. I see not reasons to bring it to the core. |
implicitDependencies
option to cache
I renamed this issue to reflect it |
Precondition: docs
Usually we have a lots of queries which is tied to user session. Common usecases:
But there is no api to provide this knowledge for cache (it usually does not passed in params but backend takes it from session tokens)
The text was updated successfully, but these errors were encountered: