Repository navigation
Page Activity and Audit past the newest 50 events - #1326
Merged
Merged
Conversation
Settings > Activity and Admin > Audit share one query, and it asked the server for one page and never followed nextCursor. A used install with 298 events showed the newest 50 as "49 events", as if that were the whole trail, and an older event could not be reached at all. The query is now an infinite query over the server's cursor. "Show older events" under the last row loads the next page until the server stops answering a cursor, and while older events remain the count reads "Newest 50 events" instead of passing for the total. Search and the Outcome, Bot and Started by filters still narrow the rows loaded; the saved views and a Bot's own page are asked of the server, as before. The audit tests now seed the cache as one page of the paged query.
davidmckayv
requested review from
MikeRyanDev,
dustywusty,
guidovizoso,
mxmzb,
samjulien and
tylerslaton
as code owners
November 9, 2026 01:58
…vity-paging # Conflicts: # CHANGELOG.md
…vity-paging # Conflicts: # CHANGELOG.md
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.
What was wrong
Settings > Activity (personal edition) and Admin > Audit render the same page and the same query,
auditEventsQueryOptionsinapp/src/lib/audit/queries.ts. It askedGET /api/admin/audit-eventsonce and never followednextCursor. On a used install with 298 events, Activity showed the newest 50 as "49 events" (two rows fold into one action), read as the whole trail, and older events could not be reached at all.What changed
auditEventsQueryOptionsis aninfiniteQueryOptionsfactory keyedauditKeys.list(search). An older page sends the same view's query pluscursor;getNextPageParamreads the server'snextCursor, which is absent on the last page.Admin > Audit shares the page, so it gets the same fix.
Tests
app/tests/activity-older-events.test.tsxrenders the real Activity route against a fetch fake shaped like the server route: page one is 50 rows plus a base64url cursor, and page two is 10 rows with nonextCursor. It checks that the first page shows "Newest 50 events", that Show older events loads rows 51 to 60 with the sameexcludeEventTypeview plus the cursor, that the count becomes "60 events", and that the button goes away. It fails onrelease/1.0(count reads "50 events", no control) and passes here.app/tests/seed-audit-page.ts.bun testacross the audit and activity files: 83 pass. Whole app suite: everything passes except one file that needsTEST_DATABASE_URL, which isn't set locally.tsc --noEmitand biome are clean.