I'm in the process of implementing rtk-query and am having problems with the polling feature of the library.
### service.js
export const api = createApi({
...,
endpoints: (builder) => ({
getBlockPurchase: builder.query({
query: (id) => `block-purchases/${id}/`,
}),
}),
});
### component.js
function BlockPurchaseComponent({ blockPurchaseId }) {
const { data, error } = useGetBlockPurchaseQuery(blockPurchaseId, {
pollingInterval: 3000,
});
...
}
The query works fine once, however subsequent polling requests are not sent. In the docs it makes it seem simple, however it looks like I'm missing something. Please let me know any other information that would be useful for helping to find the solution.
EDIT: Here was the middleware that was setup incorrectly:
const store = configureStore({
reducer: persistedReducer,
middleware: getDefaultMiddleware({
serializableCheck: {
ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
},
...api.middleware,
}),
});