Skip to content

Commit

Permalink
fix: return default object from item callback
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed May 17, 2024
1 parent afda0c4 commit 9e0cd9d
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const BLOCK = "block";
interface UseMoveBlock {
move: (current: number, next: number) => void;
}

export const useMoveBlock = (elementId: string): UseMoveBlock => {
const handler = useEventActionHandler();
const rootElementId = useRecoilValue(rootElementAtom);
Expand Down Expand Up @@ -44,15 +45,18 @@ export const useMoveBlock = (elementId: string): UseMoveBlock => {
move
};
};

interface XYCoord {
x: number;
y: number;
}

interface DragItem {
index: number;
id: string;
type: string;
}

interface UseSortableListArgs {
index: number;
id: string;
Expand Down Expand Up @@ -150,7 +154,14 @@ export const useSortableList = ({ index, move, type, beginDrag, endDrag }: UseSo
if (typeof beginDrag === "function") {
return beginDrag(monitor);
}
return null;

return {
type,
target: [BLOCK],
id: ref.current?.id,
index,
dragInNavigator: true
};
},
collect: monitor => ({
isDragging: monitor.isDragging()
Expand Down

0 comments on commit 9e0cd9d

Please sign in to comment.