redux-essentials-example-app icon indicating copy to clipboard operation
redux-essentials-example-app copied to clipboard

[BUG] addReaction.onQueryStarted should also update getPost(id) query cache.

Open nandin-borjigin opened this issue 3 years ago • 2 comments

In the RTK version of the tutorial, addReaction mutation optimistically updates the reaction data in the getPosts cache. But it should also update the cache for getPost(id) query as well. Otherwise, addReaction mutation is not reflected in the SinglePostPage.

I cannot contribute a PR because this version of code doesn't have a corresponding branch (it only has a tag).

https://github.com/reduxjs/redux-essentials-example-app/blob/dcc6064e3f0edfb859d33e28ef03fd8a010ad4a0/src/features/api/apiSlice.js#L43-L60

nandin-borjigin avatar Dec 30 '22 14:12 nandin-borjigin

How to update the cache for getPost(id)?

Rockung avatar Mar 31 '23 12:03 Rockung

Very belated answer, but yeah, good catch! I missed that.

I'm working on some updates to the example app and tutorial, and will include that.

markerikson avatar Feb 01 '24 03:02 markerikson