Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e622b6e
improvement(tables): improve table filtering UX
waleedlatif1 Mar 29, 2026
bcc7974
fix(table-filter): use ref to stabilize handleRemove/handleApply call…
waleedlatif1 Mar 29, 2026
5d037ac
improvement(tables,kb): remove hacky patterns, fix KB filter popover …
waleedlatif1 Mar 29, 2026
2e67864
feat(knowledge): add sort and filter to KB list page
waleedlatif1 Mar 29, 2026
866e91d
feat(files): add sort and filter to files list page
waleedlatif1 Mar 29, 2026
6c18471
feat(scheduled-tasks): add sort and filter to scheduled tasks page
waleedlatif1 Mar 29, 2026
f46f83c
fix(table-filter): use explicit close handler instead of toggle
waleedlatif1 Mar 29, 2026
8a1f3dc
improvement(files,knowledge): replace manual debounce with useDebounc…
waleedlatif1 Mar 29, 2026
4899dc3
fix(resource): prevent popover from inheriting anchor min-width
waleedlatif1 Mar 29, 2026
f6edb88
feat(tables): add sort to tables list page
waleedlatif1 Mar 29, 2026
51c9df9
feat(knowledge): add content and owner filters to KB list
waleedlatif1 Mar 29, 2026
12ea734
feat(scheduled-tasks): add status and health filters
waleedlatif1 Mar 29, 2026
a3ffc2f
feat(files): add size and uploaded-by filters to files list
waleedlatif1 Mar 29, 2026
0142c69
feat(tables): add row count, owner, and column type filters
waleedlatif1 Mar 29, 2026
2553cac
improvement(scheduled-tasks): use combobox filter panel matching logs…
waleedlatif1 Mar 29, 2026
9dd3028
improvement(knowledge): use combobox filter panel matching logs UI style
waleedlatif1 Mar 29, 2026
446a665
improvement(files): use combobox filter panel matching logs UI style
waleedlatif1 Mar 29, 2026
c56e3ac
improvement(tables): use combobox filter panel matching logs UI style
waleedlatif1 Mar 29, 2026
f0e988d
feat(settings): add sort to recently deleted page
waleedlatif1 Mar 29, 2026
bf0bcf3
feat(logs): add sort to logs page
waleedlatif1 Mar 29, 2026
ffe6806
improvement(knowledge): upgrade document list filter to combobox style
waleedlatif1 Mar 29, 2026
483c35c
fix(resources): fix missing imports, memoization, and stale refs acro…
waleedlatif1 Mar 29, 2026
c8672f7
improvement(tables): remove column type filter
waleedlatif1 Mar 29, 2026
71794bb
fix(resources): fix filter/sort correctness issues from audit
waleedlatif1 Mar 29, 2026
aeeec6b
fix(chunks): add server-side sort to document chunks API
waleedlatif1 Mar 29, 2026
7b13a1a
perf(resources): memoize filterContent JSX across all resource pages
waleedlatif1 Mar 29, 2026
90bd958
fix(resources): add missing sort options for all visible columns
waleedlatif1 Mar 29, 2026
0318725
whitelabeling updates, sidebar fixes, files bug
waleedlatif1 Mar 29, 2026
432e4d0
increased type safety
waleedlatif1 Mar 29, 2026
f8a26a3
pr fixes
waleedlatif1 Mar 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(chunks): add server-side sort to document chunks API
Chunk sort was previously done client-side on a single page of
server-paginated data, which only reordered the current page.
Now sort params (sortBy, sortOrder) flow through the full stack:
types → service → API route → query hook → useDocumentChunks → document.tsx.
  • Loading branch information
waleedlatif1 committed Mar 29, 2026
commit aeeec6b3bc8dde7462195b1fbef1a275e3f0bdb8
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const GetChunksQuerySchema = z.object({
enabled: z.enum(['true', 'false', 'all']).optional().default('all'),
limit: z.coerce.number().min(1).max(100).optional().default(50),
offset: z.coerce.number().min(0).optional().default(0),
sortBy: z.enum(['chunkIndex', 'tokenCount', 'enabled']).optional().default('chunkIndex'),
sortOrder: z.enum(['asc', 'desc']).optional().default('asc'),
})

const CreateChunkSchema = z.object({
Expand Down Expand Up @@ -88,6 +90,8 @@ export async function GET(
enabled: searchParams.get('enabled') || undefined,
limit: searchParams.get('limit') || undefined,
offset: searchParams.get('offset') || undefined,
sortBy: searchParams.get('sortBy') || undefined,
sortOrder: searchParams.get('sortOrder') || undefined,
})

const result = await queryChunks(documentId, queryParams, requestId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,19 +571,19 @@ export function UserInput({
const items = e.clipboardData?.items
if (!items) return

const imageFiles: File[] = []
const pastedFiles: File[] = []
for (const item of Array.from(items)) {
if (item.kind === 'file' && item.type.startsWith('image/')) {
if (item.kind === 'file') {
const file = item.getAsFile()
if (file) imageFiles.push(file)
if (file) pastedFiles.push(file)
}
}

if (imageFiles.length === 0) return
if (pastedFiles.length === 0) return

e.preventDefault()
const dt = new DataTransfer()
for (const file of imageFiles) {
for (const file of pastedFiles) {
dt.items.add(file)
}
filesRef.current.processFiles(dt.files)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,21 @@ export function Document({
refreshChunks: initialRefreshChunks,
updateChunk: initialUpdateChunk,
isFetching: isFetchingChunks,
} = useDocumentChunks(knowledgeBaseId, documentId, currentPageFromURL, '', enabledFilterParam)
} = useDocumentChunks(
knowledgeBaseId,
documentId,
currentPageFromURL,
'',
enabledFilterParam,
activeSort?.column === 'tokens'
? 'tokenCount'
: activeSort?.column === 'status'
? 'enabled'
: activeSort
? 'chunkIndex'
: undefined,
activeSort?.direction
Comment thread
waleedlatif1 marked this conversation as resolved.
)

const { data: searchResults = [], error: searchQueryError } = useDocumentChunkSearchQuery(
{
Expand Down Expand Up @@ -241,25 +255,7 @@ export function Document({

const rawDisplayChunks = showingSearch ? paginatedSearchResults : initialChunks

const displayChunks = useMemo(() => {
if (!activeSort || !rawDisplayChunks) return rawDisplayChunks ?? []
const { column, direction } = activeSort
return [...rawDisplayChunks].sort((a, b) => {
let cmp = 0
switch (column) {
case 'index':
cmp = a.chunkIndex - b.chunkIndex
break
case 'tokens':
cmp = (a.tokenCount ?? 0) - (b.tokenCount ?? 0)
break
case 'status':
cmp = (a.enabled ? 1 : 0) - (b.enabled ? 1 : 0)
break
}
return direction === 'asc' ? cmp : -cmp
})
}, [rawDisplayChunks, activeSort])
const displayChunks = rawDisplayChunks ?? []

const currentPage = showingSearch ? searchCurrentPage : initialPage
const totalPages = showingSearch ? searchTotalPages : initialTotalPages
Expand Down Expand Up @@ -871,10 +867,16 @@ export function Document({
{ id: 'status', label: 'Status' },
],
active: activeSort,
onSort: (column, direction) => setActiveSort({ column, direction }),
onClear: () => setActiveSort(null),
onSort: (column, direction) => {
setActiveSort({ column, direction })
void goToPage(1)
},
onClear: () => {
setActiveSort(null)
void goToPage(1)
},
}),
[activeSort]
[activeSort, goToPage]
)

const chunkRows: ResourceRow[] = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ export function KnowledgeBase({
content: (
<Tooltip.Root>
<Tooltip.Trigger asChild>
<div style={{ cursor: 'help' }}>{getStatusBadge(doc)}</div>
<div className='cursor-help'>{getStatusBadge(doc)}</div>
</Tooltip.Trigger>
<Tooltip.Content side='top' className='max-w-xs'>
{doc.processingError}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,6 @@ export function CollapsedTaskFlyoutItem({
title={task.name}
isActive={!!task.isActive}
isUnread={!!task.isUnread}
statusIndicatorClassName={
!(isCurrentRoute || isMenuOpen) ? 'group-hover:hidden' : undefined
}
/>
</Link>
{showActions && (
Expand Down
Loading
Loading