Skip to content

Commit

Permalink
fixing issue with a form element sometimes getting deleted when you i…
Browse files Browse the repository at this point in the history
…nsert a new one.
  • Loading branch information
skimble committed Oct 1, 2024
1 parent 33af772 commit e1443ae
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 e1443ae

Please sign in to comment.