f0a1552
ZhenYi
feat(chat): add chat module with room management, message handling, and session revocation
f0a1552
import { boardKey, prefetch, spaceMembersPageKey } from '@/shared/lib'
import {
getBoard,
listIssues,
listLabels,
listMilestones,
listSpaceMembers,
type IssueQuery,
} from '@/entities/issue'
import { ISSUE_PAGE_SIZE } from './use-board-data'
/**
* The query a board mounts with (board-location defaults: state `open`, sort
* `created`, page 1). Field order matters — `useBoardData` derives its cache
* key from `JSON.stringify(query)`, so this literal must produce the exact
* same string as the board view's.
*/
const DEFAULT_QUERY: IssueQuery = {
state: 'open',
q: undefined,
priority: undefined,
labelId: undefined,
milestoneId: undefined,
assigneeId: undefined,
sort: 'created',
limit: ISSUE_PAGE_SIZE,
offset: 0,
}
/** Hover prefetch for the board column: everything `useBoardData` loads. */
export function prefetchBoardView(space: string, board: string): void {
if (!space || !board) return
const ref = { space, board }
void prefetch(boardKey(space, board, 'board'), () => getBoard(ref))
void prefetch(boardKey(space, board, 'labels'), () => listLabels(ref))
void prefetch(boardKey(space, board, 'milestones'), () => listMilestones(ref))
void prefetch(boardKey(space, board, `issues:${JSON.stringify(DEFAULT_QUERY)}`), () =>
listIssues(ref, DEFAULT_QUERY),
)
void prefetch(spaceMembersPageKey(space), () => listSpaceMembers(space))
}