Comments (3)
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:
- The layout is broken for the
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 parentSurface
with aBox
to allow overlay behaviour. - The state is being published through the compose runtime
MutableState
. If you define a state as a data class (in our case theFoodCategoriesContract.State
) and inherit a field i.e.isLoading
from an abstract classViewState
, any changes on the fields that are inherited from theViewState
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
.
from android-compose-mvvm-foodies.
- Yes you can use that. The issue with that approach is that if you toggle the loading, the content (the list) will not be visible again until you hide the loading again.
Since the PR is merged, I will close this issue. Thanks again!
from android-compose-mvvm-foodies.
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 ;)
from android-compose-mvvm-foodies.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-compose-mvvm-foodies.