feat(tasks): server-side scope filtering, pagination, and draft bug fix (#1135)
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -47,6 +47,14 @@ describe('parseTaskQuery', () => {
|
||||
const parsed = parseTaskQuery('is:draft')
|
||||
expect(parsed.scope).toBe('pr')
|
||||
expect(parsed.state).toBe('open')
|
||||
expect(parsed.draft).toBe(true)
|
||||
})
|
||||
|
||||
it('is:pr is:open does not set draft', () => {
|
||||
const parsed = parseTaskQuery('is:pr is:open')
|
||||
expect(parsed.scope).toBe('pr')
|
||||
expect(parsed.state).toBe('open')
|
||||
expect(parsed.draft).toBe(false)
|
||||
})
|
||||
|
||||
it('extracts assignee, author, label, and review qualifiers', () => {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export type ParsedTaskQuery = {
|
||||
scope: 'all' | 'issue' | 'pr'
|
||||
state: 'open' | 'closed' | 'all' | 'merged' | null
|
||||
draft: boolean
|
||||
assignee: string | null
|
||||
author: string | null
|
||||
reviewRequested: string | null
|
||||
@@ -23,6 +24,7 @@ export function parseTaskQuery(rawQuery: string): ParsedTaskQuery {
|
||||
const query: ParsedTaskQuery = {
|
||||
scope: 'all',
|
||||
state: null,
|
||||
draft: false,
|
||||
assignee: null,
|
||||
author: null,
|
||||
reviewRequested: null,
|
||||
@@ -60,6 +62,7 @@ export function parseTaskQuery(rawQuery: string): ParsedTaskQuery {
|
||||
if (normalized === 'is:draft') {
|
||||
query.scope = 'pr'
|
||||
query.state = 'open'
|
||||
query.draft = true
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
// Why: per-repo fetch budget for gh CLI calls. Kept in shared/ so the renderer's
|
||||
// prefetch sites (SidebarNav, ui.ts openTaskPage) and the TaskPage all use the
|
||||
// same value for cache-key alignment.
|
||||
export const PER_REPO_FETCH_LIMIT = 36
|
||||
|
||||
// Why: how many items to show after cross-repo merge. Decoupled from the per-repo
|
||||
// fetch limit so changing the display cap doesn't invalidate cache keys.
|
||||
export const CROSS_REPO_DISPLAY_LIMIT = 100
|
||||
|
||||
// Why: generic over the item shape because main-process callers emit items
|
||||
// without repoId (stamped by the renderer after IPC), while renderer callers
|
||||
// carry the full GitHubWorkItem. Both share only the updatedAt field needed
|
||||
|
||||
Reference in New Issue
Block a user