amplitude/redux-query

Feature Request - Add useRequests hooks

mili-confluent opened this issue · 5 comments

redux-query-react has the hook: useRequest but it did not support requests for multiple requests, so I am planning to create a hook useRequests which can send a lot of requests at the same time.

Hey @mili-confluent, this is actually the next step on the roadmap for redux-query-react. Hopefully will have a PR open in the next week or so along with an alpha release. Would love to get your feedback when I open the PR.

@rctbusk Saw this was in the docs and available, I think, but TS is not finding the exported function (wondering if somehow types are out-of-date?)

image

edit: Indeed it looks like it may be missing here https://github.com/amplitude/redux-query/blob/master/packages/redux-query-react/index.d.ts#L49

I could see if I could whip up a quick PR, hmm.

I find there is a lot of cancel query warning when I use conncetRequest. It seems we did not return the function correctly so that the finished callback did not really delete the pending key.

const finishedCallback = useConstCallback(() => {
(queryKey: QueryKey) => {
pendingRequests.current.delete(queryKey);
};
});

These PRs are included in the newest version release. 3.3.1. Let me know if this issues are fixed. Closing this issue unless hearing otherwise.