Bringing back the idea of checking for change before updating the screen. The check happens between 500us and 1ms and the screen update generally in 10-100ms

This commit is contained in:
Vitor Pamplona
2023-03-03 19:40:26 -05:00
parent ea905ef6ed
commit 5e5c393472
3 changed files with 8 additions and 4 deletions
@@ -63,9 +63,9 @@ abstract class FeedViewModel(val localFilter: FeedFilter<Note>): ViewModel() {
val oldNotesState = feedContent.value
if (oldNotesState is FeedState.Loaded) {
// Using size as a proxy for has changed.
//if (notes != oldNotesState.feed.value) {
if (notes != oldNotesState.feed.value) {
updateFeed(notes)
//}
}
} else {
updateFeed(notes)
}
@@ -38,7 +38,9 @@ open class LnZapFeedViewModel(val dataSource: FeedFilter<Pair<Note, Note>>): Vie
val oldNotesState = feedContent.value
if (oldNotesState is LnZapFeedState.Loaded) {
// Using size as a proxy for has changed.
updateFeed(notes)
if (notes != oldNotesState.feed.value) {
updateFeed(notes)
}
} else {
updateFeed(notes)
}
@@ -42,7 +42,9 @@ open class UserFeedViewModel(val dataSource: FeedFilter<User>): ViewModel() {
val oldNotesState = feedContent.value
if (oldNotesState is UserFeedState.Loaded) {
// Using size as a proxy for has changed.
updateFeed(notes)
if (notes != oldNotesState.feed.value) {
updateFeed(notes)
}
} else {
updateFeed(notes)
}