Replies: 2 comments 2 replies
-
You can use |
Beta Was this translation helpful? Give feedback.
0 replies
-
@EskiMojo14 Tnx, but not sure how to properly implement this. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I am currently in process of refactoring an React app to utilize rtk-query. I have following component parent component Page:
In Categories/Tags component I have list of categories and tags. The query for fetching these categories/tags does not exists
as separate endpoint, I am reusing
useFetchPageQuery()
to get those in type of an array, for this specific page.And for Page API I have set tag 'Page'.
For categories/tags create/update/delete operations I have separate api's endpoints. When I call them, I clear the cache with
invalidatesTags
invalidatesTags: ['Page']
This is working as expected, except that both Categories and Tags components get's re-rendered(which is kind of expected behavior) considering that they use same query hook which is fired once cache is cleared.
Is there an option or should I re-organize my code in some other way, that once for example I delete category that only Categories component gets re-rendered, not Tags also.
I don't have the ability to change my backend API to fetch Categories/Tags for Page in separate endpoints(this would mostly solve the issue).
Thank you
Beta Was this translation helpful? Give feedback.
All reactions