fix(core): Fix backwards pagination not working if channel was never opened#2789
Draft
VelikovPetar wants to merge 2 commits into
Draft
fix(core): Fix backwards pagination not working if channel was never opened#2789VelikovPetar wants to merge 2 commits into
VelikovPetar wants to merge 2 commits into
Conversation
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Submit a pull request
Linear: FLU-547
Github Issue: #
CLA
Description of the pull request
When a user enters a channel with
unread_count > 0but the server-side read state haslast_read_message_id = nullandlast_read = 0001-01-01T00:00:00Z(Go'stime.Time{}zero value — the "never explicitly read" sentinel),StreamChannel._maybeInitChannelwas unconditionally callingloadChannelAtTimestamp(currentUserRead.lastRead).The backend silently ignores zero-time
created_at_around(viaIsZero()) and returns the channel tail. The client then mis-infers boundaries via_inferBoundariesFromAnchorTimestamp: because year-1 is before every loaded message, it concludesendOfPrependReached: true, sets_topPaginationEnded = true, and backwards pagination is permanently dead on the channel.The fix guards the timestamp branch on
lastRead.toUtc().isAfter(DateTime.utc(1970, 1, 1)). When it's the zero sentinel, the code falls through to the existing catch-all if(channel.state?.isUpToDate == false) loadChannelAtMessage(null)— i.e. stay on cached latest if up-to-date, otherwise reload latest.Adds a
_maybeInitChanneltest group with three regression guards:idAroundforlastReadMessageId,createdAtAroundfor real timestamps, and no query for the Go zero-time case.Screenshots / Videos
pagin-before.mp4
pagin-after.mp4