-
Notifications
You must be signed in to change notification settings - Fork 3.2k
improvement(kb): add document filtering, select all, and React Query migration #2951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile Summary
Important Files Changed
Confidence score: 4/5
Sequence DiagramsequenceDiagram
participant User
participant API as "GET /api/knowledge/[id]/documents"
participant Auth as "getSession"
participant Access as "checkKnowledgeBaseAccess"
participant Service as "getDocuments"
participant DB as "Database"
User->>API: "GET with enabledFilter param"
API->>Auth: "getSession()"
Auth-->>API: "session"
alt session invalid
API-->>User: "401 Unauthorized"
else session valid
API->>Access: "checkKnowledgeBaseAccess(id, userId)"
Access->>DB: "verify access"
DB-->>Access: "access result"
alt no access
Access-->>API: "hasAccess: false"
API-->>User: "401/404 error"
else has access
Access-->>API: "hasAccess: true, knowledgeBase"
API->>Service: "getDocuments(id, filters, requestId)"
Service->>DB: "query with enabledFilter"
DB-->>Service: "documents + pagination"
Service-->>API: "documents data"
API-->>User: "200 success with filtered documents"
end
end
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
26 files reviewed, 1 comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| async (newPage: number) => { | ||
| if (newPage < 1 || newPage > totalPages) return | ||
| (newPage: number): boolean => { | ||
| return newPage >= 1 && newPage <= totalPages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
goToPage function no longer performs navigation
High Severity
The goToPage function in useDocumentChunks was changed from an async function that performs navigation to a synchronous function that only validates page numbers. However, the consuming code still calls await initialGoToPage(page) expecting it to perform navigation. This breaks chunk pagination functionality entirely.
Additional Locations (1)
| {renderSortableHeader('chunkCount', 'Chunks', 'w-[8%]')} | ||
| {renderSortableHeader('uploadedAt', 'Uploaded', 'w-[11%]')} | ||
| {renderSortableHeader('processingStatus', 'Status', 'w-[10%]')} | ||
| {renderSortableHeader('enabled', 'Status', 'w-[10%]')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Status column sorts by enabled instead of processing status
Medium Severity
The Status column header sorts by enabled field but displays processing status badges (Pending, Processing, Failed, Enabled/Disabled). This creates a mismatch where clicking the Status column header sorts by enabled/disabled boolean instead of the displayed processing status, producing unexpected and confusing sort results.
Additional Locations (1)
| setSelectedDocuments(new Set(documents.map((doc) => doc.id))) | ||
| } else { | ||
| setSelectedDocuments(new Set()) | ||
| setIsSelectAllMode(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Select-all mode not cleared when deselecting documents
High Severity
When in select-all mode (selecting all documents across all pages), manually deselecting an individual document via checkbox doesn't clear isSelectAllMode. This causes bulk operations to still affect all documents, including ones the user explicitly deselected, leading to data loss or unintended modifications.
Summary
Type of Change
Testing
Tested manually
Checklist