Content pfp
Content
@
0 reply
0 recast
2 reactions

Gabriel Ayuso pfp
Gabriel Ayuso
@gabrielayuso.eth
There's no way an app will be fast enough without keeping most state local. Having a proper sync engine and local state isn't trivial but once it's setup you can reduce a lot of the issues that come with fetching and caching since the sync engine ensures that your app has the data and it's up to date. https://x.com/karrisaarinen/status/1834463400975544778
5 replies
6 recasts
18 reactions

Samuel pfp
Samuel
@samuellhuber.eth
Have you played around with local first sync? one thing I am yet to figure out is how to show the few parts one has 3rd party APIs in a way that's pleasant if the rest is so fast.
1 reply
0 recast
0 reaction

Gabriel Ayuso pfp
Gabriel Ayuso
@gabrielayuso.eth
I've done "local first" on native, not on web yet. It's possible to do local first with 3p APIs you just need to write a custom way to continuously call the APIs and merge the results with the data you have locally. That's basically what I did with Tumblr APIs back in the day. You could also just integrate the 3p API on your backend and not your client, if possible.
2 replies
0 recast
1 reaction

Samuel pfp
Samuel
@samuellhuber.eth
yeah I was thinking about polling it, though if the user has a "needs to be current at modal popup" then that may lead to the polling of say ~15s to not be up to date. or I need to go a push based route of pushing updates to the local state and have the backend manage that. then user can add locally and gets backend adds instantly or API writes throuhg pushes. I hate the thought of going back to polling backends just to be recent but in some cases it seems like that's the way without webhooks being there. e.g. twitter API
1 reply
0 recast
1 reaction

Gabriel Ayuso pfp
Gabriel Ayuso
@gabrielayuso.eth
yeah it's annoying. what I did for the Tumblr app IIRC was I essentially had a background thread that was just constantly polling at certain intervals. I don't recall if I added a way for the app to do a hard pull on parts of the app such as when opening a dialog to edit a post to make sure we have the latest version. It worked offline. I think I just used a latest edit wins sync approach on conflicts. Depending on the API, doing it on the backend could provide a much better experience since you have more control and can update your backend state even when the user isn't on the app. Tradeoffs as usual
0 reply
0 recast
1 reaction