()
| 26 | } |
| 27 | |
| 28 | export function useCreateColumnMutation() { |
| 29 | const queryClient = useQueryClient() |
| 30 | return useMutation({ |
| 31 | mutationFn: createColumn, |
| 32 | onMutate: async (variables) => { |
| 33 | await queryClient.cancelQueries() |
| 34 | queryClient.setQueryData( |
| 35 | boardQueries.detail(variables.data.boardId).queryKey, |
| 36 | (board) => |
| 37 | board |
| 38 | ? { |
| 39 | ...board, |
| 40 | columns: [ |
| 41 | ...board.columns, |
| 42 | { |
| 43 | ...variables.data, |
| 44 | order: board.columns.length + 1, |
| 45 | id: Math.random() + '', |
| 46 | }, |
| 47 | ], |
| 48 | } |
| 49 | : undefined, |
| 50 | ) |
| 51 | }, |
| 52 | }) |
| 53 | } |
| 54 | |
| 55 | export function useCreateItemMutation() { |
| 56 | const queryClient = useQueryClient() |
no test coverage detected