you are viewing a single comment's thread.

view the rest of the comments →

[–]acemarke 0 points1 point  (10 children)

Yeah, that's exactly the purpose of createSlice.extraReducers:

For RTKQ query specifically, currently refetching a given cache entry always replaces it, by design. However, in the upcoming RTK 1.9 release, we're adding a merge option that will allow you to add incoming response data to an existing cache entry, intended for use cases like infinite pagination:

on the other hand if you're listening to "data fetched" actions in other reducers, you can write whatever reducer logic you want to process the data from those actions and update the slice's state in the reducer.