Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only one AppState may make performance issue? #3

Closed
jiqimaogou opened this issue Apr 15, 2021 · 2 comments
Closed

only one AppState may make performance issue? #3

jiqimaogou opened this issue Apr 15, 2021 · 2 comments

Comments

@jiqimaogou
Copy link

in the example, there is only one AppState, any ScreeState change make AppState change, and make the top level widget recompute. may this cause performance issue?

@dbaroncelli
Copy link
Owner

dbaroncelli commented Apr 15, 2021

We actually want to trigger a UI layer recomposition (by changing the AppState value) each time there is a change in the ScreenState. On each recomposition, both JetpackCompose and SwiftUI are smart enough to update only the components whose data has changed.
The fact there is only one AppState is actually good for performance, as we require ONLY ONE observable, which is our StateFlow having the AppState as its value.

@jiqimaogou
Copy link
Author

ok, thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants