You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It might be useful to be able to tag the response with the ids of those products, even though we only know those after we've received the response. That way, when a related product changes, it can correctly invalidate this response.
Something similar might also be useful for revalidate.
Non-Goals
listing current cache tags
changing the API in a non-backwards-compatible way
Background
One example where this is used is RTK Query, where providesTags is allowed to be a function that takes the response.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Goals
In some cases it might be useful to provide cache tags to a cache entry, after the result has been received.
For instance: I might fetch a product from the api:
however, I might want to include related products in the response:
It might be useful to be able to tag the response with the ids of those products, even though we only know those after we've received the response. That way, when a related product changes, it can correctly invalidate this response.
Something similar might also be useful for
revalidate
.Non-Goals
Background
One example where this is used is RTK Query, where
providesTags
is allowed to be a function that takes the response.In next something similar could look like:
Proposal
Allow passing an (async) function to
tags
that gets passed the response and returns a list of tags.Beta Was this translation helpful? Give feedback.
All reactions