You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be useful to have the queryKey or mutationKey added to the request in order to identify which query is triggering that request.
exportconstgetTodoByIdQueryOptions= ... {const queryKey =queryOptions?.queryKey??getTodoByIdQueryKey(todoId,params);// add queryKey paramconstqueryFn: QueryFunction<Awaited<ReturnType<typeofgetTodoById>>>=({ signal })=>getTodoById(key,params,signal,queryKey);
...
}exportconstgetTodoById=(todoId: string,params?: GetTodoByIdParams,signal?: AbortSignal,// add queryKey paramqueryKey: QueryKey,)=>{returncustomInstance<TodoResponse>({url: `/todos/${encodeURIComponent(String(todoId))}`,method: 'GET',
params,
signal,// include queryKey to the request.
queryKey
});}
since queryKey can be either set, when using useTodoByIdQuery or when undefined it uses getTodoByIdQueryKey to set it.
it would make a lot easier if the "actual" queryKey used was passed to the request.
this would allow to correlate request / query by queryKey, making easier to update cache, logging, notification etc, without the need to customize the query itself in a wrapper.
ideally, allowing that for mutation as well, by including mutationKey to the request.
there could be a config allowing turning this on/off.
Thanks
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Feature Request
docs for reference.
It would be useful to have the
queryKey
ormutationKey
added to the request in order to identify which query is triggering that request.since
queryKey
can be either set, when usinguseTodoByIdQuery
or whenundefined
it usesgetTodoByIdQueryKey
to set it.it would make a lot easier if the "actual"
queryKey
used was passed to the request.this would allow to correlate request / query by
queryKey
, making easier to update cache, logging, notification etc, without the need to customize the query itself in a wrapper.ideally, allowing that for mutation as well, by including
mutationKey
to the request.there could be a config allowing turning this on/off.
Thanks
The text was updated successfully, but these errors were encountered: