First and foremost, thank you for the very good work in RFR and in this awesome article series. I find myself enjoying Redux again after quite a while and that’s certainly due to simplicity and efficiency of RFR.
Now, got a quick question regarding the loading state. I was used to handle the loading logic directly inside the component but that no longer seems to apply here. In the samples you are using something like this to determine if the UniversalComponent should render the loading or not.
const isListFetching = (page, videosByCategory) => {
const { category, categories } = videosByCategory
return page === 'List' && !categories[category]
}As actual apps may have several different sources, this function would soon be a lot more complex and handle too much responsibilities.
I thought about keeping a shared loading value in the state, but that would be susceptible to racing conditions when the user switch page before the loading finishes. Another idea was to keep a loading value for every page needed and somehow get this value using the page value.
What’d be your advice on how to structure the code so that the loading works on a scenario of multiple sources consistently?
Once again, thank for you hard work.
