Mark Erikson
Mark Erikson
I'm not sure I understand the problem that's being described. `merge` is a callback for updating the data inside of a given cache entry, by letting you combine the old...
@haleyngonadi I'm not clear on what you expect to have happen, exactly. Are you expecting a full refetch to happen? Are you getting back data with a request, and the...
@haleyngonadi The `merge` callback is effectively a standard Immer `produce` function, which means that you can return a complete value instead of mutating the draft argument. So, you _should_ be...
@haleyngonadi : yes, although there's two things that would need to change in that snippet: - _return_ a value rather than mutating `cache` - in the case of `createEntityAdapter` specifically,...
There's a couple tricky bits here: - `merge` _only_ gets called when there is already data in the cache entry. In other words, `merge` will _not_ be called for the...
@koukalp yeah, there's a couple different sub-threads going on in this issue, which is also why I'm confused myself :) My first note is that the whole "use `merge` as...
Circling back to this thread. While this isn't a direct answer to the issues being discussed, we shipped full infinite query support in RTK 2.6. That should remove the need...
@gwy15 : yeah, there's a lot more nuance to it than what is described in the docs. In some cases React may try to check if the update would result...
Dunno how the dots would get connected, but Brian Vaughn has extracted a bunch of his Suspense cache utils from the Replay codebase into a standalone package at https://suspense.vercel.app/ ....
@rjgotten : what actual end-user API are you visualizing here? How would this be accessed via `useQuery()` ?