redux-toolkit
redux-toolkit copied to clipboard
Document polymorphicBaseQuery recipe and export types needed
The recipe in https://github.com/reduxjs/redux-toolkit/discussions/3161 would be good to have documented, and it currently relies on internal types which would need to be exported for it.
I have noticed some weird behaviour with the polymorphicBaseQuery. When calling a query directly using api.endpoints.getMyQuery() it won't await it properly.
For example:
const response = await dispatch(
enhancedDashboardGraphqlApi.endpoints.GetKanbanTasks.initiate(
{ projects, taskIds },
{ forceRefetch: true },
),
)
console.log(response)
// {
// "status": "pending",
// "endpointName": "GetKanbanTasks",
// "startedTimeStamp": 1719911870610,
// "fulfilledTimeStamp": 1719911868943,
// "isUninitialized": false,
// "isLoading": true,
// "isSuccess": false,
// "isError": false,
// "data": staleData
// }
@Innders can you make a minimal reproduction of that? i've never experienced that personally
minimal reproduction
I can't seem to reproduce with a minimal setup, maybe it's something else. Ignore me then 😄