Component not re-rendering on removeQueries()
I have a
I am using
For each
In my
When the
Using
Now in a different part of my application I want to invalidate the data and trigger a refetch in
I tried to accomplish this by using
However this is not updating my component. The component will not re-render after the query cache is removed.
I am missing something? How can I properly trigger a re-render of my
FlatList with items. Lets call them FlatListItem.I am using
memo to memoize my Items to prevent them to re-render when the parent changes using export default memo(FlatListItem);For each
FlatListItem in my list I have to fetch data. In a separate file I define a hook and a query function. Simplified they are looking like this:In my
FlatListItem I will then use useGetDataQuery:When the
FlatListItem is loaded for the first time it all works as expected.Using
!isSuccess I can show a loading indicator and when loading is done my data is shown.Now in a different part of my application I want to invalidate the data and trigger a refetch in
FlatListItem. Again, with a loading indicator and when loaded the data should be shown.I tried to accomplish this by using
removeQueries:However this is not updating my component. The component will not re-render after the query cache is removed.
I am missing something? How can I properly trigger a re-render of my
FlatListItem?