({
);
useEffect(() => {
- setItems(sortByLexorank(initialItems));
+ setItems(initialItems);
}, [initialItems]);
const sensors = useDndSensors();
diff --git a/src/components/dnd/SortableItem/DragHandle.tsx b/src/components/dnd/SortableItem/DragHandle.tsx
index cd6a3d6..64cf2a4 100644
--- a/src/components/dnd/SortableItem/DragHandle.tsx
+++ b/src/components/dnd/SortableItem/DragHandle.tsx
@@ -1,5 +1,6 @@
import React, { CSSProperties, ReactNode } from "react";
import { useDraggable } from "@dnd-kit/core";
+import useIsMobile from "@/hooks/useIsMobile";
type Props = {
id: number | string;
@@ -13,6 +14,7 @@ const DragHandle = ({ id, children, style, disabled }: Props) => {
id,
disabled,
});
+ const isMobile = useIsMobile();
return (
{
touchAction: "auto",
...style,
}}
+ className={isMobile ? "" : "swiper-no-swiping"}
ref={setNodeRef}>
{children}
diff --git a/src/hooks/useBoardsOperations.tsx b/src/hooks/useBoardsOperations.tsx
index 0c20bdd..de36cd2 100644
--- a/src/hooks/useBoardsOperations.tsx
+++ b/src/hooks/useBoardsOperations.tsx
@@ -15,7 +15,11 @@ import {
updateBoardMutation,
} from "@/lib/client/@tanstack/react-query.gen";
import { notifications } from "@/lib/notifications";
-import { getMaxByLexorank, getNewLexorank } from "@/utils/lexorank";
+import {
+ getMaxByLexorank,
+ getNewLexorank,
+ sortByLexorank,
+} from "@/utils/lexorank";
type UseBoardsOperationsProps = {
boards: BoardSchema[];
@@ -87,16 +91,18 @@ export const useBoardsOperations = ({
});
setBoards(boards =>
- boards.map(oldBoard =>
- oldBoard.id !== boardId
- ? oldBoard
- : {
- id: oldBoard.id,
- name: board.name ? board.name : oldBoard.name,
- lexorank: board.lexorank
- ? board.lexorank
- : oldBoard.lexorank,
- }
+ sortByLexorank(
+ boards.map(oldBoard =>
+ oldBoard.id !== boardId
+ ? oldBoard
+ : {
+ id: oldBoard.id,
+ name: board.name ? board.name : oldBoard.name,
+ lexorank: board.lexorank
+ ? board.lexorank
+ : oldBoard.lexorank,
+ }
+ )
)
);
};