fix(issues): use TanStack Query for sub-issue data fetching (#499)
The sub-issue code was using direct `api` calls, but the codebase was refactored to TanStack Query and the `api` import was removed from issue-detail.tsx, causing a build error on Vercel. Replace useState+useEffect with useQuery for both parent and child issue fetching, consistent with the TQ migration.
This commit is contained in:
parent
a8a8ff6eca
commit
4bdb86057e
2 changed files with 21 additions and 32 deletions
|
|
@ -6,6 +6,8 @@ export const issueKeys = {
|
|||
list: (wsId: string) => [...issueKeys.all(wsId), "list"] as const,
|
||||
detail: (wsId: string, id: string) =>
|
||||
[...issueKeys.all(wsId), "detail", id] as const,
|
||||
children: (wsId: string, id: string) =>
|
||||
[...issueKeys.all(wsId), "children", id] as const,
|
||||
timeline: (issueId: string) => ["issues", "timeline", issueId] as const,
|
||||
reactions: (issueId: string) => ["issues", "reactions", issueId] as const,
|
||||
subscribers: (issueId: string) =>
|
||||
|
|
@ -47,6 +49,13 @@ export function issueDetailOptions(wsId: string, id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
export function childIssuesOptions(wsId: string, id: string) {
|
||||
return queryOptions({
|
||||
queryKey: issueKeys.children(wsId, id),
|
||||
queryFn: () => api.listChildIssues(id).then((r) => r.issues),
|
||||
});
|
||||
}
|
||||
|
||||
export function issueTimelineOptions(issueId: string) {
|
||||
return queryOptions({
|
||||
queryKey: issueKeys.timeline(issueId),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue