vivlim / pillbug

a (work in progress) gotosocial client
Other
26 stars 8 forks source link

Minimize requests being made to nodes #5

Open Sorixelle opened 2 months ago

Sorixelle commented 2 months ago

Currently, pillbug makes no attempt to cache requests in memory. I'm a bit concerned about this, especially when it comes to large threads - this could potentially result in a lot of redundant requests being made to nodes as users go back and forth between threads.

I'd recommend looking into a solution for data fetching/state management/caching before this becomes too much of an architectural overhaul to implement easily. TanStack Query is typically my go-to solution for this sort of thing - there's likely other options out there to consider.

vivlim commented 2 months ago

I suspect this may be a premature optimization. From a quick peek at my browser's dev tools looking at XHRs & scrolling around in semaphore and phanpy, and some very brief poking around akkoma-fe, it seems like other clients don't bother to cache much.

We could do a bit more in pillbug, especially around the fancier abstractions (e.g. storing the result of gathering a share's context recursively) but I think inserting an unfamiliar layer between the ui and megalodon at this stage would substantially slow project velocity.