You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
web/hooks/use-windowed-messages.ts, line 54-56 (link)
Pagination cursor points to summary timestamp instead of first conversation message
When the oldest item in the timeline is a leading activity_summary (activities that predate the first conversation message), msgs[0].timestamp is the synthetic summary timestamp — MAX(activity.created_at) — which is earlier than the first real conversation message. When the user triggers "load older", before = that_timestamp is sent to the server, which finds zero conversation messages before it and falls into the len(rows) == 0 path. That path returns a new summary counting activities with created_at < max_activity, i.e., all but the last activity in the range. The client then prepends this near-duplicate summary (with count - 1), leaving the user with two conflicting leading summaries and hasOlder immediately set back to false.
A related issue on the same block: setHasOlder(apiMsgs.length >= PAGE_SIZE) counts interleaved activity_summary items toward the threshold, so conversations with enough summaries trigger hasOlder = true even when all conversation messages fit on a single page — directly enabling the incorrect cursor scenario above. The correct signal is whether the number of conversation messages returned equaled the requested limit.
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
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.
Summary
Closes #362
Tests