(projectId: string, options?: ListTasksParams)
| 97 | const params = queryKey[2] |
| 98 | if (!params || typeof params !== 'object') return true |
| 99 | const boardProjectId = (params as { projectId?: unknown }).projectId |
| 100 | return boardProjectId == null || boardProjectId === projectId |
| 101 | } |
| 102 | |
| 103 | export function removeTaskFromBoardCaches( |
| 104 | queryClient: QueryClient, |
| 105 | taskId: string, |
| 106 | projectId?: string, |
| 107 | ): TaskBoardSnapshot { |
| 108 | const predicate = (query: { queryKey: QueryKey }) => isTaskBoardQueryKey(query.queryKey, projectId) |
| 109 | const snapshots = queryClient.getQueriesData<TaskBoardResponse>({ predicate }) |
| 110 | |
| 111 | queryClient.setQueriesData<TaskBoardResponse>({ predicate }, (current) => { |
| 112 | if (!current || !Array.isArray(current.data)) return current |
| 113 | const nextData = current.data.filter((task) => task.id !== taskId) |
| 114 | if (nextData.length === current.data.length) return current |
| 115 | return { |
| 116 | ...current, |
| 117 | data: nextData, |
no test coverage detected