mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-02 09:47:47 -05:00
fix: paged lists repeat some entries and skip others (#35281)
The admin user list, feedbacks, groups, the workspace models, prompts and skills lists, prompt history, notes, shared chats, automations, calendar search, analytics messages and SCIM user listings are loaded page by page, and when many rows share the sorted value (a role, a bulk-import timestamp, a rating) the database is free to return those ties in a different order for each page. On PostgreSQL 16, paging through 300 users sorted by role showed 16 users twice and never showed 16 others, and with an id tiebreaker every user showed up exactly once. These lists now sort by each entry's id as a last step, as the chats and knowledge lists already do. Fixes #35280
This commit is contained in:
1 parent
00ad719de0
commit
2d03af81ef
12 files changed
+24
-8
No files matched your search
@@ -701,6 +701,8 @@ class NoteTable:
|
||||
else:
|
||||
stmt = stmt.order_by(Note.updated_at.desc())
|
||||
|
||||
stmt = stmt.order_by(Note.id)
|
||||
|
||||
# Count BEFORE pagination
|
||||
count_result = await db.execute(select(func.count()).select_from(stmt.subquery()))
|
||||
total = count_result.scalar()
|
||||
@@ -747,7 +749,7 @@ class NoteTable:
|
||||
user_groups = await Groups.get_groups_by_member_id(user_id, db=db, include_inherited=True)
|
||||
user_group_ids = [group.id for group in user_groups]
|
||||
|
||||
stmt = select(Note).order_by(Note.updated_at.desc())
|
||||
stmt = select(Note).order_by(Note.updated_at.desc(), Note.id)
|
||||
stmt = self._has_permission(db, stmt, {'user_id': user_id, 'group_ids': user_group_ids}, permission)
|
||||
|
||||
if skip is not None:
|
||||
|
||||
Reference in new issue
Block a user