redux-toolkit icon indicating copy to clipboard operation
redux-toolkit copied to clipboard

Document polymorphicBaseQuery recipe and export types needed

Open EskiMojo14 opened this issue 1 year ago • 3 comments

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.

EskiMojo14 avatar Jul 01 '24 22:07 EskiMojo14

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 avatar Jul 02 '24 09:07 Innders

@Innders can you make a minimal reproduction of that? i've never experienced that personally

EskiMojo14 avatar Jul 07 '24 21:07 EskiMojo14

minimal reproduction

I can't seem to reproduce with a minimal setup, maybe it's something else. Ignore me then 😄

Innders avatar Jul 15 '24 10:07 Innders