useSWR returns undefined when preload fails #2898
Unanswered
AndonMitev
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I might not fully understand your question, but preload(`casts-${filter}`, () => fetchCastsWithFilterActionV2({ filter })); |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
So I have a component with effect that prefetches few lists:
fetchCastsWithFilterActionV2 - simple fetch from nextjs
then in list component i have:
That reads the data but sometimes this data comes as undefined not every time tho.
Sometime i can observe is that if i use only:
data is fetched every time successfully.
In my app i have table with 5 filters - 5 different lists which i'm trying to preload. I think that if any of the lists has not been preloaded:
will return
undefined
? Is this assumption correct?Is it possible somehow to force useSWR if preload has not completed to triggers fetch? Also is there what i can do to make sure that preload can be executed successfully and navigation is not going to disturb them?
Beta Was this translation helpful? Give feedback.
All reactions