mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Fix jump-to-unread requiring two taps for an out-of-window read marker (#6943)
* Fix jump-to-unread requiring two taps for an out-of-window read marker * Update features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelinePresenter.kt Co-authored-by: Benoit Marty <benoitm@element.io> --------- Co-authored-by: Benoit Marty <benoitm@element.io>
This commit is contained in:
+6
-1
@@ -333,7 +333,12 @@ class TimelinePresenter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LaunchedEffect(timelineItems.size, focusRequestState.value) {
|
// Keyed on the full [timelineItems] reference (not just .size) so we re-resolve the index
|
||||||
|
// when a focused timeline loads with the same item count as the window it replaced — e.g.
|
||||||
|
// jumping to an out-of-window read marker in a busy room, where both windows fill to the
|
||||||
|
// same page size. With .size as the key the effect wouldn't re-run, the focused event's
|
||||||
|
// index would stay unresolved, and the scroll would never fire until a second tap.
|
||||||
|
LaunchedEffect(timelineItems.map { it.identifier() }, focusRequestState.value) {
|
||||||
val currentFocusRequestState = focusRequestState.value
|
val currentFocusRequestState = focusRequestState.value
|
||||||
if (currentFocusRequestState is FocusRequestState.Success && !currentFocusRequestState.rendered) {
|
if (currentFocusRequestState is FocusRequestState.Success && !currentFocusRequestState.rendered) {
|
||||||
val eventId = currentFocusRequestState.eventId
|
val eventId = currentFocusRequestState.eventId
|
||||||
|
|||||||
Reference in New Issue
Block a user