fix: only tanstack usage in optimistic updates
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
import React from "react";
|
||||
import { LexoRank } from "lexorank";
|
||||
import { useCrudOperations } from "@/hooks/cruds/baseCrud";
|
||||
import {
|
||||
@ -15,9 +14,8 @@ import { getMaxByLexorank, getNewLexorank } from "@/utils/lexorank";
|
||||
|
||||
type UseBoardsOperationsProps = {
|
||||
boards: BoardSchema[];
|
||||
setBoards: React.Dispatch<React.SetStateAction<BoardSchema[]>>;
|
||||
refetchBoards: () => void;
|
||||
projectId?: number;
|
||||
queryKey: any[];
|
||||
};
|
||||
|
||||
export type BoardsCrud = {
|
||||
@ -28,15 +26,13 @@ export type BoardsCrud = {
|
||||
|
||||
export const useBoardsCrud = ({
|
||||
boards,
|
||||
setBoards,
|
||||
refetchBoards,
|
||||
projectId,
|
||||
queryKey,
|
||||
}: UseBoardsOperationsProps): BoardsCrud => {
|
||||
return useCrudOperations<BoardSchema, UpdateBoardSchema, CreateBoardSchema>(
|
||||
{
|
||||
entities: boards,
|
||||
setEntities: setBoards,
|
||||
refetch: refetchBoards,
|
||||
key: "getBoards",
|
||||
queryKey,
|
||||
mutations: {
|
||||
create: createBoardMutation(),
|
||||
update: updateBoardMutation(),
|
||||
|
||||
Reference in New Issue
Block a user