Skip to content

Commit

Permalink
Solved issue: initial layout selection not applied
Browse files Browse the repository at this point in the history
  • Loading branch information
silviubogan committed Oct 12, 2020
1 parent 9f633d6 commit add0c02
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/ColumnsBlock/ColumnsBlockEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,11 @@ class ColumnsBlockEdit extends React.Component {
const cols = this.props.data.data?.blocks_layout?.items || [];
const prevCols = prevProps.data.data?.blocks_layout?.items || [];

console.log('val', this.props.data.gridCols);
if (
cols.length !==
prevCols.length /* ||
this.props.data.gridCols?.length === 0 */
) {
const colNumChanged = cols.length !== prevCols.length;
const notInitialLayoutSelection = prevCols.length !== 0;
const shouldUpdateLayout = colNumChanged && notInitialLayoutSelection;

if (shouldUpdateLayout) {
const available_variants = variants.filter(
({ defaultData }) => defaultData?.gridCols?.length === cols.length,
);
Expand Down

0 comments on commit add0c02

Please sign in to comment.