Repository navigation
improve data fetching strategy #1278
TkDodo
started this conversation in
Anything Else
Replies: 1 comment 2 replies
|
Hi @TkDodo! Yes this is definitely something we could improve upon. Everything in your comment is dead on, these are real problems on our dashboard. I guess it's just not hasn't been a big enough problem to make me tackle it properly yet. I hadn't heard of react-query but it looks really useful for our dashboard. Seems a lot easier than hand-rolling this stuff :) I will keep this library in mind for future reference. Happy to merge a PR that adds react-query but it will be a pretty big job so up to you if you're interested in contributing @TkDodo. |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hey, thanks for your cool product 🚀
I've been looking at the dashboard today, and as a react-query maintainer, I can't unsee the bunch of loading spinners that are popping up every time I filter for some data. I also cannot see when the dashboard was last refreshed / how accurate the data is (which makes me hard-reload the page a lot). I only found out by looking at the code that there seems to be a 30 second refetch interval. Looking at the network tab, I can also see that requests are going out to the same resource multiple times (like e.g. 6 requests going out at the same time to retrieve the current-visitors!)
I think react-query would be a good fit for such a dashboard. Features like
refetchIntervaland window-focus-refetching would make sure that data is always up-to-date, and the stale-while-revalidate caching strategy, paired with background loading indicators, would make sure that users would always see data, which makes the whole dashboard feel snappier. Requests going out at the same time would also be de-duplicated, leading to less server load.Let me know if you're interested and if / how I can contribute to this 👋
All reactions