drag-and-drop icon indicating copy to clipboard operation
drag-and-drop copied to clipboard

Store not updating on drag and drop when using useDragAndDrop hook with Redux Toolkit

Open poojadosad opened this issue 2 months ago • 1 comments

When using the useDragAndDrop hook from your library in conjunction with Redux Toolkit, the Redux store is not updating after a drag and drop operation.

Here's how I used the hook.

const kanbanStore = useSelector((state: { kanbanReducer: KanbanType }) => state.kanbanReducer);
const dispatch = useDispatch();

const [boardRef, columns, setColumns] = useDragAndDrop(kanbanStore.columns, {
  plugins: [animations()],
  dragHandle: '.list-handle'
});

I expect the Redux store to update when a drag and drop operation is performed.

I'm using Next.js with React and Redux Toolkit for state management. The issue occurs when I try to drag and drop items on the Kanban board. The local state (columns) updates correctly, but the changes are not reflected in the Redux store.

Any help would be appreciated. Thanks!

poojadosad avatar Apr 15 '24 13:04 poojadosad

Where are you using the dispatch?

aarjithn avatar Apr 24 '24 12:04 aarjithn