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
My goal is to have some state which does an initial fetch, and then I'll manually control refetches from that point on. I'd also like to give it an initial value (in this case an empty array) rather the it be undefined, so I combined useSWRImmutable with a fallback option in hopes of achieving this. Unfortunately it failed to fetch entirely, and it seems it was pointed out in another thread that fallback data is treated as stale data and therefore prevents revalidation... But it doesn't seem right to even prevent an initial fetch. I just feel like that kinda defeats the purpose of anything if that's what happens in this scenario.
Expected Behavior
I expected there to still be an initial fetch.
Repro Steps / Code Example
Here's some code that had the fallback data. It triggered no initial fetch.
The moment I removed it, I can do an initial fetch, but lose out on default data. Perhaps in this scenario I could just put in a default value for data... but I feel like that's not proper and could lead to confusion if future values actually expected to be undefined.
Additional Context
SWR version: 2.3.0
The text was updated successfully, but these errors were encountered:
I'm choosing to close this issue. I realize that there are scenarios where I actually WOULD like useSWRImmutable to never even do an initial fetch. So I think the way it is right now gives the most flexibility and is preferable:
If I want the initial fetch, I'll just have a default value for the data.
If I dont want an initial fetch but still want a default value, then I'll use the fallback data.
Bug report
Description / Observed Behavior
My goal is to have some state which does an initial fetch, and then I'll manually control refetches from that point on. I'd also like to give it an initial value (in this case an empty array) rather the it be undefined, so I combined useSWRImmutable with a fallback option in hopes of achieving this. Unfortunately it failed to fetch entirely, and it seems it was pointed out in another thread that fallback data is treated as stale data and therefore prevents revalidation... But it doesn't seem right to even prevent an initial fetch. I just feel like that kinda defeats the purpose of anything if that's what happens in this scenario.
Expected Behavior
I expected there to still be an initial fetch.
Repro Steps / Code Example
Here's some code that had the fallback data. It triggered no initial fetch.
The moment I removed it, I can do an initial fetch, but lose out on default data. Perhaps in this scenario I could just put in a default value for data... but I feel like that's not proper and could lead to confusion if future values actually expected to be undefined.
Additional Context
SWR version: 2.3.0
The text was updated successfully, but these errors were encountered: