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
functionmultiFetcher(...urls){returnPromise.all(urls.map(url=>fetcher(url))}const[urls,setUrls]=useState([]);const{ data }=useSWR(urls,multiFetcher)
When I add an element by calling setUrls the data is loaded fine, but the cache is invalidated because the array has changed and the fetcher is called for the previous loaded urls too.
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
-
When I add an element by calling setUrls the data is loaded fine, but the cache is invalidated because the array has changed and the fetcher is called for the previous loaded urls too.
How to fix this.
Beta Was this translation helpful? Give feedback.
All reactions