feat: bounded message window for centered Jump to Message#7388
feat: bounded message window for centered Jump to Message#7388diegolmello wants to merge 9 commits into
Conversation
WalkthroughThis PR implements anchored message observation windows for Jump-to-Message O(1) performance, refactors scroll orchestration as a state machine, and hardens connection handling. It adds ChangesBounded Message Window
Connection and Sync Hardening
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…calls sdk.methodCall appended `this.code || ''` (the TOTP code) as a trailing positional argument to every DDP method call. That empty string was a harmless ignored extra until the server's loadSurroundingMessages method grew a typed `showThreadMessages: boolean` 3rd param (RocketChat/Rocket.Chat #39092). The '' then fails the server's `check(showThreadMessages, Boolean)`, returning a 500 that rejects loadSurroundingMessages and aborts the whole jump-to-message flow (loading shows, no navigation). Append the TOTP code only when a 2FA flow is in progress, so non-2FA DDP calls send exactly their declared params — matching the REST path and the server default. The 2FA flow is preserved: the codeless first call still gets totp-required, then the retry appends the resolved code. Covered by the existing .maestro/tests/room/jump-to-message.yaml flow.
… guard scroll-to-index retry NATIVE-1229 bounded-window jump validation checkpoint. - useMessages: on Anchored Window RELEASE, grow the Live Window by the count of cached messages above the old bound (count += aboveCount) so a deep jump target is not evicted by take(count) and the view no longer snaps to the Live Tail. - useScroll: defer one frame + cap the onScrollToIndexFailed retry to break the synchronous VirtualizedList re-fire recursion (stack overflow) on an unmeasurable target; re-read the target at fire time so a stale retry cannot scroll wrong. - getLocalAnchor / getMessageInfo / services: anchored-jump re-seed wiring. - Regression tests: useMessages (release window growth), useScroll (deferred+capped retry), getLocalAnchor. Includes temporary [JUMP-DBG] instrumentation; to be stripped before merge.
…ntation Strip the in-runtime debug buffer, DB-primitive globals, and the deterministic jump/climb drivers used to validate the bounded-window jump on-device. The real fixes (anchored-window release growth, scroll-to-index retry guard, isMessageInWindow) are unaffected.
|
iOS Build Available Rocket.Chat 4.74.0.109044 |
Proposed changes
Rebuilds Jump to Message on a bounded message window so a deep jump re-anchors in one step (O(1)) instead of growing the window page-by-page (O(pages)) — removing the root cause of the old 5s-race flakiness — without migrating off the custom native inverted list.
The whole capability is one optional upper
tsbound (highTs) on the existing WatermelonDB observation:highTs == null→ Live Window (newest-first, follows the Live Tail) — unchanged default behavior.highTs→ Anchored Window pinned around the target, below the Live Tail.A pure, DB/React-free anchor resolver decides the bound (
anchorForTarget) and climbs it back toward live as Newer Loaders are consumed (raiseOrRelease), releasing to a Live Window only once the Gap to the Live Tail has fully closed (invariant: never release across an open Gap). "Rejoin live" is now explicit — the Load Newer chain or the jump-to-bottom FAB (which stays visible while anchored).Also included:
take(count)and the list doesn't snap to the Live Tail.onScrollToIndexFailed(nogetItemLayout→ the inverted list re-fires it synchronously → stack overflow).isMessageInWindow), not message origin, so a locally-cached-but-out-of-window target no longer silently aborts; three roads (in-window / cached-out-of-window / server) plus a target-ts fallback.loadSurroundingMessagescall; one-shot jump param so re-searching the same message re-fires.Design rationale and the rejected alternative (FlashList v2 migration) are in the ADR at
app/views/RoomView/docs/adr/0001-bounded-window-over-flashlist.md. New domain vocabulary is inUBIQUITOUS_LANGUAGE.md(§ Message Loading).Issue(s)
https://rocketchat.atlassian.net/browse/NATIVE-1224
How to test or reproduce
Screenshots
No static UI redesign; changes are behavioral (centered jump; FAB visibility while anchored).
Types of changes
Checklist
Further comments
The list engine is unchanged; a future FlashList migration remains possible but is neither required nor blocked by this work. Ordering stays
ts-only (ats + _idcomposite is a deferred follow-up noted in the ADR). New unit coverage:anchorResolver,useMessages(release-window growth),useScroll(deferred + capped retry),getLocalAnchor.Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Documentation