Skip to content

Commit

Permalink
fix for empty default
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidsector9 committed Jan 31, 2024
1 parent 2e612d4 commit efcf67b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions components/repeater/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export const AttributeRepeater = ({ children, attribute, addButton, allowReorder
};
});

defaultRepeaterData[0].id = uuid();
if ( defaultRepeaterData.length ) {
defaultRepeaterData[0].id = uuid();
}

const handleOnChange = (value) => {
updateBlockAttributes(clientId, { [attribute]: value });
Expand Down Expand Up @@ -114,7 +116,7 @@ export const AbstractRepeater = ({
const defaultValueCopy = JSON.parse(JSON.stringify(defaultValue));

if (!defaultValue.length) {
defaultValueCopy.push([]);
defaultValueCopy.push({});
}

defaultValueCopy[0].id = uuid();
Expand Down

0 comments on commit efcf67b

Please sign in to comment.