Closed JustJerem closed 3 years ago
First, thank you for your feedback. Secondly, this is a great catch. I investigated and there are actually 2 issues causing the loading bar to not appear anymore:
FoodCategoriesScreen
in the sense that the loading bar can never appear on top of the list if it's populated. This can be fixed by replacing the parent Surface
with a Box
to allow overlay behaviour.MutableState
. If you define a state as a data class (in our case the FoodCategoriesContract.State
) and inherit a field i.e. isLoading
from an abstract class ViewState
, any changes on the fields that are inherited from the ViewState
abstraction will not make the UI recompose.This is something I didn't expect and I'm not really sure why Compose is behaving this way. To fix it, I removed the abstract isLoading
field and added it manually to the FoodCategoriesContract.State
. At this moment, this is the only fix I could find.
The issues are addressed in this PR which I will merge soon.
If you want to test your above behavior, check out the just-jerem-delay-test
.
Thank you for testing.
Is something like this not possible in the end?
if (state.isLoading)
LoadingBar()
else
FoodCategoriesList(...)
And yes, while doing my tests, I came to the same conclusion that Compose did not recompose itself in the case of a legacy. It's a waste, let's see how it evolves because it's a good approach.
Thanks again ;)
Since the PR is merged, I will close this issue. Thanks again!
I'm trying to change the state information but this doesn't work if a delay is applied.
But the effect is well applied for this line.
Do we know why ?
All in all, good job for this architecture.