diff --git a/src/blocks/advanced-form/fields/checkbox/edit.js b/src/blocks/advanced-form/fields/checkbox/edit.js index d4fe1cb3f..b43e4b407 100644 --- a/src/blocks/advanced-form/fields/checkbox/edit.js +++ b/src/blocks/advanced-form/fields/checkbox/edit.js @@ -120,23 +120,19 @@ function FieldCheckbox({ attributes, setAttributes, isSelected, clientId, contex updateOption(index, { selected: !options[index].selected }); }; - function onOptionMoveUp(oldIndex) { - return () => { - if (oldIndex === 0) { - return; - } - onOptionMove(oldIndex, oldIndex - 1); - }; - } + const onOptionMoveUp = (oldIndex) => { + if (oldIndex === 0) { + return; + } + onOptionMove(oldIndex, oldIndex - 1); + }; - function onOptionMoveDown(oldIndex) { - return () => { - if (oldIndex === options.length - 1) { - return; - } - onOptionMove(oldIndex, oldIndex + 1); - }; - } + const onOptionMoveDown = (oldIndex) => { + if (oldIndex === options.length - 1) { + return; + } + onOptionMove(oldIndex, oldIndex + 1); + }; function onOptionMove(oldIndex, newIndex) { if (!options) { @@ -149,6 +145,7 @@ function FieldCheckbox({ attributes, setAttributes, isSelected, clientId, contex options.splice(oldIndex, 1, tmpValue); setAttributes({ options }); + setRerender(Math.random()); } const removeOptionItem = (previousIndex) => { @@ -222,7 +219,7 @@ function FieldCheckbox({ attributes, setAttributes, isSelected, clientId, contex