fix(messages): default topic message list to newest-first ordering#2547
Closed
jvorcak wants to merge 1 commit into
Closed
fix(messages): default topic message list to newest-first ordering#2547jvorcak wants to merge 1 commit into
jvorcak wants to merge 1 commit into
Conversation
The default topic message view (non-continuous pagination, "Newest" origin, last-50) rendered rows in raw backend/stream order rather than newest-first, so messages were not sorted by timestamp descending as users expect. Client-side sort was only applied in the narrow `continuousPaginationEnabled && startOffset === EndMinusResults` case, introduced in #2229. The default paginated path fell through to the unsorted list. Apply a stable newest-first sort (timestamp desc, then offset desc as a cross-partition tiebreak) to the full loaded set before client-side pagination, so page 1 of a last-50 fetch shows the globally newest rows. Header click still overrides via the sorted row model. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
🚨 Registry drift detectedApp:
Components needing attention
Refresh command: bunx shadcn@latest add @redpanda/dropdown-menu --overwriteGenerated by lookout audit-changes. |
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.
Problem
The default topic message view — non-continuous pagination, Newest origin, last-50 (shipped defaults:
startOffset=-1/EndMinusResults,maxResults=50,continuousPaginationEnabled=false) — rendered rows in the backend's stream order, not newest-first. A customer reported it:Root cause
ListMessagesRequesthas no sort-order field, and the backend'slistMessagesstreams per-partition, so the merged result is not globally timestamp-sorted across partitions. The frontend never imposed an order on the default (non-continuous) view — it only sorted in the narrowcontinuousPaginationEnabled && EndMinusResultsbranch. So the default view showed whatever order the stream arrived in.Note: this is not a regression from #2229 or #2486 — the default path has never sorted the multi-partition stream, and the backend doesn't sort it either. There is no request parameter that can make the backend return globally sorted results, so the ordering has to be imposed client-side.
Fix
Drive the table's own sorted row model via a sensible default for the existing
sortURL param, instead of a bespoke row-list sort:DEFAULT_SORTINGis now[timestamp desc, offset desc](offset isn't global across partitions, so timestamp is the primary key and offset is a stable tiebreak — matching the customer's expectation).getSorting()treats an empty/unset sort as "use the default", so the newest-first default also applies for returning users whose persisted settings still hold the old empty sort.Continuous-pagination mode disables header sorting, so the explicit newest-first sort is kept for its "Newest" fetch (now with the same
offsettiebreak for determinism).Scope / limitations
Verification
bun run type:check— passes.bun run lint— no new issues in the changed files.bun run test— no new failures (the one failingobservability-pagetest also fails on the clean tree; unrelated).🤖 Generated with Claude Code