Skip to content

Commit

Permalink
Merge pull request #319 from gnr/dnd-fixes
Browse files Browse the repository at this point in the history
Fixing issue when dragging new item from toolbox
  • Loading branch information
Kiho authored Oct 7, 2024
2 parents 33af772 + e1443ae commit 5c0bf97
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/preview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@ export default class Preview extends React.Component {
moveCard(dragIndex, hoverIndex) {
const { data } = this.state;
const dragCard = data[dragIndex];
this.saveData(dragCard, dragIndex, hoverIndex);
// happens sometimes when you click to insert a new item from the toolbox
if (dragCard !== undefined) {
this.saveData(dragCard, dragIndex, hoverIndex);
}
}

// eslint-disable-next-line no-unused-vars
Expand Down

0 comments on commit 5c0bf97

Please sign in to comment.