Re:Data fetching on the web still sucks
by robertoandred on Wednesday January 27, 2021 @11:53AM
(#25930481)
SWR or react-query?
[ Parent
| on HN ]
Re:Data fetching on the web still sucks
by dinkleberg on Wednesday January 27, 2021 @12:50PM
(#25931325)
I started my current project using SWR and then switched to react-query after dealing with some annoyances with SWR.
Overall react-query is impressive for data fetching, but I’ve run into issues with mutations and cache invalidation.
Re:Data fetching on the web still sucks
by AgentME on Wednesday January 27, 2021 @01:07PM
(#25931562)
I've been disappointed at how SWR and react-query seem to only support the bare minimum for mutations. As far as I can tell, they don't offer any kind of protection from refreshes overwriting any local mutations that haven't been saved to the server yet. They don't do any handling around updating the data on the server, so you need to handle issues yourself like retrying, deciding when to send to the server, and making sure you never have overlapping update requests racing each other. I've had trouble finding any library in the React or general JS ecosystem that handles this stuff.
Re:Data fetching on the web still sucks
by shuding on Wednesday January 27, 2021 @01:44PM
(#25932104)
Hey! SWR author here. Mind sharing the annoyances and how I can make it better for you?
Re:Data fetching on the web still sucks
by andrewrothman on Wednesday January 27, 2021 @09:30PM
(#25937361)
Thanks for your contribution and outreach! SWR has been really helpful for us at work.