-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
When adding new entities into a query's cache using updateQueryData, "api.provided" isn't updated (UPDATED) #3251
Comments
Looking at the source it seems like there isn't a way to update the So to achieve our goal, we'll probably have to maintain an "extendedProvided" slice, shape it as RTKQ's The reason we need to update the provided tags of a (list) query is that we later use that data to "know" which queries to optimistically update later on, when mutations occur. And, though I am biased, it makes sense to me that the provided tags should be in-sync with the queries’ cache. Our app is built in a way where all the data is fetched once, and from that point on, no invalidations ever occur. Everything is optimistically/pessimistically updated. We also set up DB subscriptions for all "active" queries (all mounted Will it be accepted if I make a PR that adds 2 (exported) case-reducers into |
You are perfectly right, that should never have been missing. Unfortunately, I just don't have the capacity to see this through myself right now fully - but I would be very open to a PR to add Of course, this doesn't come without it's own problems: This would call |
Hey @phryneas, I submitted a PR (just code changes, no tests or updates to docs yet as I wasn't sure whether or not this would get approved). I ended up adding I exposed a new case-reducer from Hope this works out! |
That was #3255 . |
When calling
updateQueryData
, is there a way to update the provided tags of the query whose cache was updated?Our optimistic update needs to opt. CREATE an entity (that didn’t exist before) and add it into a query’s cache.
That new entity is now inside the cache, but not listed inside
api.provided
, since it didn’t go through the “regular” flow (fetched through a list/get endpoint).Is there a way to also update that list/get endpoint’s provided tags?
The text was updated successfully, but these errors were encountered: