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
Hi there, we have a use-case which requires the data to be loaded onto the page as requests are returned (not sequentially, not all at once, but load as data comes in).
For example, there are 3 requests:
Request
Request Time
A
10s
B
2s
C
5s
We would like to the data to be available immediately as follows:
Time
Data
2s
[null, B, null]
5s
[null, B, C]
10s
[A, B, C]
I have looked into useSWRInfinite with both initalSize and setSize, however, it seems like all the requests have to complete before the data is returned.
From my testing with useSWRInfinite,
If I put initialSize: 3, all 3 requests have to complete before data is returned.
If I put initialSize: 1 then subsequently call setSize(3), it waits until all 3 requests are completed before returning data, not as they became available.
Could you please help me find an example / solution that could accomplish what I'm proposing above?
UPDATE:
Looks like this use-case would be resolved by having a useQueries hook. As mentioned in #1041#1038
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there, we have a use-case which requires the data to be loaded onto the page as requests are returned (not sequentially, not all at once, but load as data comes in).
For example, there are 3 requests:
We would like to the data to be available immediately as follows:
I have looked into
useSWRInfinite
with bothinitalSize
andsetSize
, however, it seems like all the requests have to complete before the data is returned.From my testing with
useSWRInfinite
,initialSize: 3
, all 3 requests have to complete before data is returned.initialSize: 1
then subsequently callsetSize(3)
, it waits until all 3 requests are completed before returning data, not as they became available.Could you please help me find an example / solution that could accomplish what I'm proposing above?
UPDATE:
Looks like this use-case would be resolved by having a
useQueries
hook. As mentioned in #1041 #1038Beta Was this translation helpful? Give feedback.
All reactions