Skip to content

fix(messages): default topic message list to newest-first ordering#2547

Closed
jvorcak wants to merge 1 commit into
masterfrom
fix/messages-default-ordering-timestamp-desc
Closed

fix(messages): default topic message list to newest-first ordering#2547
jvorcak wants to merge 1 commit into
masterfrom
fix/messages-default-ordering-timestamp-desc

Conversation

@jvorcak

@jvorcak jvorcak commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

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:

I would expect sorted by timestamp descending (and secondarily by offset descending). Particularly if we're getting last-50. Ideally you'd sort by offset, but of course offset isn't global across partitions and so timestamp is the next best thing.

Root cause

ListMessagesRequest has no sort-order field, and the backend's listMessages streams 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 narrow continuousPaginationEnabled && EndMinusResults branch. 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 sort URL param, instead of a bespoke row-list sort:

  • DEFAULT_SORTING is 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.
  • The Timestamp/Offset column headers now show the sort direction, and the sort is shareable/persisted via the URL.

Continuous-pagination mode disables header sorting, so the explicit newest-first sort is kept for its "Newest" fetch (now with the same offset tiebreak for determinism).

Scope / limitations

  • This is a client-side sort of the loaded window. For the reported last-50 case that's the entire result, so it's fully correct. A globally-correct order across pagination boundaries would require a backend-side sort (separate, larger change).
  • The default now applies to all non-continuous origins (including "From beginning"/custom), not only "Newest" — a consistent newest-at-top default; users can flip it via the column header.

Verification

  • bun run type:check — passes.
  • bun run lint — no new issues in the changed files.
  • bun run test — no new failures (the one failing observability-page test also fails on the clean tree; unrelated).

🤖 Generated with Claude Code

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>
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🚨 Registry drift detected

App: frontend · Scope: diff vs origin/master · Files: 1

Count
⚠️ Outdated registry components 1
🛠 Locally-modified components 0
❓ Unknown to registry 0
🎨 Off-token palette colours 0
🔢 Ad-hoc utility classes 0
Components needing attention
Status Component Uses Detail
⚠️ outdated dropdown-menu installed 2.2.0 → latest 2.3.0

Refresh command:

bunx shadcn@latest add @redpanda/dropdown-menu --overwrite

Generated by lookout audit-changes.

@jvorcak jvorcak closed this Jul 2, 2026
@jvorcak jvorcak changed the title fix(messages): restore newest-first default ordering in topic message list fix(messages): default topic message list to newest-first ordering Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant