From dafdd894498994ef94e24f188e736b12a532e0ed Mon Sep 17 00:00:00 2001 From: Rob Gietema Date: Thu, 22 Feb 2024 11:26:24 +0100 Subject: [PATCH 1/3] Fix sidebar form update. (#5779) --- packages/volto-slate/news/5779.bugfix | 1 + .../src/blocks/Table/TableBlockEdit.jsx | 16 +++++----------- packages/volto/news/5779.bugfix | 1 + .../volto/src/components/manage/Form/Form.jsx | 2 +- 4 files changed, 8 insertions(+), 12 deletions(-) create mode 100644 packages/volto-slate/news/5779.bugfix create mode 100644 packages/volto/news/5779.bugfix diff --git a/packages/volto-slate/news/5779.bugfix b/packages/volto-slate/news/5779.bugfix new file mode 100644 index 0000000000..5c1f633b25 --- /dev/null +++ b/packages/volto-slate/news/5779.bugfix @@ -0,0 +1 @@ +Fix sidebar form update. @robgietema \ No newline at end of file diff --git a/packages/volto-slate/src/blocks/Table/TableBlockEdit.jsx b/packages/volto-slate/src/blocks/Table/TableBlockEdit.jsx index 478ba15be9..397bff13fd 100644 --- a/packages/volto-slate/src/blocks/Table/TableBlockEdit.jsx +++ b/packages/volto-slate/src/blocks/Table/TableBlockEdit.jsx @@ -5,7 +5,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { map, remove } from 'lodash'; +import { isEmpty, map, remove } from 'lodash'; import { Button, Table } from 'semantic-ui-react'; import cx from 'classnames'; import { defineMessages, injectIntl } from 'react-intl'; @@ -227,7 +227,7 @@ class Edit extends Component { * @returns {undefined} */ componentDidMount() { - if (!this.props.data.table) { + if (!this.props.data.table || isEmpty(this.props.data.table)) { this.props.onChangeBlock(this.props.block, { ...this.props.data, table: initialTable, @@ -243,7 +243,7 @@ class Edit extends Component { * @returns {undefined} */ UNSAFE_componentWillReceiveProps(nextProps) { - if (!nextProps.data.table) { + if (!nextProps.data.table || isEmpty(nextProps.data.table)) { this.props.onChangeBlock(nextProps.block, { ...nextProps.data, table: initialTable, @@ -528,10 +528,7 @@ class Edit extends Component { icon basic onClick={this.onDeleteRow} - disabled={ - this.props.data.table && - this.props.data.table.rows.length === 1 - } + disabled={this.props.data.table?.rows?.length === 1} title={this.props.intl.formatMessage(messages.deleteRow)} aria-label={this.props.intl.formatMessage(messages.deleteRow)} > @@ -569,10 +566,7 @@ class Edit extends Component { icon basic onClick={this.onDeleteCol} - disabled={ - this.props.data.table && - this.props.data.table.rows[0].cells.length === 1 - } + disabled={this.props.data.table?.rows?.[0].cells.length === 1} title={this.props.intl.formatMessage(messages.deleteCol)} aria-label={this.props.intl.formatMessage(messages.deleteCol)} > diff --git a/packages/volto/news/5779.bugfix b/packages/volto/news/5779.bugfix new file mode 100644 index 0000000000..5c1f633b25 --- /dev/null +++ b/packages/volto/news/5779.bugfix @@ -0,0 +1 @@ +Fix sidebar form update. @robgietema \ No newline at end of file diff --git a/packages/volto/src/components/manage/Form/Form.jsx b/packages/volto/src/components/manage/Form/Form.jsx index 4e444b6192..2e7c4ff4e6 100644 --- a/packages/volto/src/components/manage/Form/Form.jsx +++ b/packages/volto/src/components/manage/Form/Form.jsx @@ -280,7 +280,7 @@ class Form extends Component { } if ( this.props.global && - !isEqual(this.props.globalData, this.state.formData) + !isEqual(this.props.globalData, prevProps.globalData) ) { this.setState({ formData: this.props.globalData, From 137f90cec72632545b67058fc2ca1340b1af82fd Mon Sep 17 00:00:00 2001 From: Victor Fernandez de Alba Date: Thu, 22 Feb 2024 11:28:08 +0100 Subject: [PATCH 2/3] Release @plone/slate 18.0.0-alpha.7 --- packages/volto-slate/CHANGELOG.md | 6 ++++++ packages/volto-slate/news/5779.bugfix | 1 - packages/volto-slate/package.json | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) delete mode 100644 packages/volto-slate/news/5779.bugfix diff --git a/packages/volto-slate/CHANGELOG.md b/packages/volto-slate/CHANGELOG.md index 30dd10f4b4..756fd90751 100644 --- a/packages/volto-slate/CHANGELOG.md +++ b/packages/volto-slate/CHANGELOG.md @@ -8,6 +8,12 @@ +## 18.0.0-alpha.7 (2024-02-22) + +### Bugfix + +- Fix sidebar form update. @robgietema [#5779](https://github.com/plone/volto/issues/5779) + ## 18.0.0-alpha.6 (2024-01-25) ### Bugfix diff --git a/packages/volto-slate/news/5779.bugfix b/packages/volto-slate/news/5779.bugfix deleted file mode 100644 index 5c1f633b25..0000000000 --- a/packages/volto-slate/news/5779.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix sidebar form update. @robgietema \ No newline at end of file diff --git a/packages/volto-slate/package.json b/packages/volto-slate/package.json index 1d3d9d6077..8eadc11fee 100644 --- a/packages/volto-slate/package.json +++ b/packages/volto-slate/package.json @@ -1,6 +1,6 @@ { "name": "@plone/volto-slate", - "version": "18.0.0-alpha.6", + "version": "18.0.0-alpha.7", "description": "Slate.js integration with Volto", "main": "src/index.js", "author": "European Environment Agency: IDM2 A-Team", From 6eea1edecb0d6a3e692b5e24e4b2434f94f9ec9d Mon Sep 17 00:00:00 2001 From: Victor Fernandez de Alba Date: Thu, 22 Feb 2024 11:29:19 +0100 Subject: [PATCH 3/3] Release 18.0.0-alpha.13 --- docs/source/release-notes/index.md | 6 ++++++ packages/volto/CHANGELOG.md | 6 ++++++ packages/volto/news/5779.bugfix | 1 - packages/volto/package.json | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) delete mode 100644 packages/volto/news/5779.bugfix diff --git a/docs/source/release-notes/index.md b/docs/source/release-notes/index.md index 56868f7221..b148fe9e5c 100644 --- a/docs/source/release-notes/index.md +++ b/docs/source/release-notes/index.md @@ -17,6 +17,12 @@ myst: +## 18.0.0-alpha.13 (2024-02-22) + +### Bugfix + +- Fix sidebar form update. @robgietema [#5779](https://github.com/plone/volto/issues/5779) + ## 18.0.0-alpha.12 (2024-02-21) ### Feature diff --git a/packages/volto/CHANGELOG.md b/packages/volto/CHANGELOG.md index 56868f7221..b148fe9e5c 100644 --- a/packages/volto/CHANGELOG.md +++ b/packages/volto/CHANGELOG.md @@ -17,6 +17,12 @@ myst: +## 18.0.0-alpha.13 (2024-02-22) + +### Bugfix + +- Fix sidebar form update. @robgietema [#5779](https://github.com/plone/volto/issues/5779) + ## 18.0.0-alpha.12 (2024-02-21) ### Feature diff --git a/packages/volto/news/5779.bugfix b/packages/volto/news/5779.bugfix deleted file mode 100644 index 5c1f633b25..0000000000 --- a/packages/volto/news/5779.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix sidebar form update. @robgietema \ No newline at end of file diff --git a/packages/volto/package.json b/packages/volto/package.json index 24ec125991..c202aaf0c6 100644 --- a/packages/volto/package.json +++ b/packages/volto/package.json @@ -9,7 +9,7 @@ } ], "license": "MIT", - "version": "18.0.0-alpha.12", + "version": "18.0.0-alpha.13", "repository": { "type": "git", "url": "git@github.com:plone/volto.git"