Replies: 1 comment 4 replies
-
you can use lib like p-queue to limit the concurrent requests. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Short version:
I would like to limit the number of concurrent requests performed by useSWR, but it doesn't seem like there is a way to do so.
Long version:
I have a React module. This module attaches itself to a certain type of element. Typically, a webpage (which is not under my control) has a certain number of those elements, and my module instanciates itself for each. For each instance, an asynchronous request is performed, through useSWR.
It's usually no problem, but there are case where I have a huge number of those elements on the same page, and then a huge number of asynchronous requests are fired at the same time (which the server can't handle). The idea would be to poll those requests. Unfortunately, since all those instances don't know about each other, I can't do anything. Only useSWR would be able to do something about it.
Do you have any idea how I could do this?
Beta Was this translation helpful? Give feedback.
All reactions