Shu Ding

Results 376 comments of Shu Ding

> although I can't help but put on my old-school C programmer's hat and think that it'd be nice to not give it up, if all other considerations are equal....

Hi all! Happy to hear about your feedback on #168 🙏

You can achieve that by: ```js mutate(request, { populateCache: false, optimisticData: currentData => newData, revalidate: false } ```

Thanks, and these are great feedback, I will think about how to get these cases covered.

> the changes made in currentData => newData do not get re-rendered to be dispalyed in the UI. For this case, I just tested and SWR correctly prevents the race...

You can take a look at #168 and all the related discussions. A temporary solution can be: ```js useSWR("https://publicDataUrl/", fetcher) // preload useSWR("https://privateDataUrl", fetcher) // preload const { data: publicData...

I think this is tricky – when a component throws and gets caught by the error boundary, the hooks will be unmounted so you can't re-render anymore. The same applies...

@sergiodxa for the second example, it works like this under the hood: ```js useSWRSuspenseStart() // promises = [] const { data: user } = useSWR('/api/user') // promises.push(fetch('/api/user')) const { data:...

The reason I'm not using ```js const [user, movies] = useSWR( ['/api/user', '/api/movies'], { suspense: true } ); ``` is because it loses the ability to do dependent fetching, meaning...

Thanks for the feedback @saitonakamura! Personally I like the third one as well, but I'd wait until Suspense & react-fetch (official data fetching lib with Suspense) get finalized first and...