Does Tag invalidation work with queryFn? #1413
-
I have two endponts, export const scrollingNoteApi = createApi({
reducerPath: 'scrollingNote',
baseQuery: fetchBaseQuery({ ... }),
tagTypes: ['Comment'],
endpoints: builder => ({
getScrollingNote: builder.query(
{query: getScrollingNoteHandler, providesTags: ['Comment']}),
createComment: builder.mutation(
{queryFn: createCommentHandler, invalidatesTags: ['Comment']})
})
}) To have a cleaner code, I have these handlers: const getScrollingNoteHandler = notesList => { ... }
const createCommentHandler = async (args, queryApi, extraOptions, baseQuery) => { ... } I have a functional component that subscribes to function myFunction() {
const {data} = useGetScrollingNoteQuery(someInputThatINeedToPass)
const [createComment] = useCreateCommentMutation()
} But when I use I cannot find my mistake, am I making a mistake in |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That would work. Did you maybe forget to set up the middleware? |
Beta Was this translation helpful? Give feedback.
That would work. Did you maybe forget to set up the middleware?