@plone/volto 17.15.0 → 17.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -17,6 +17,12 @@ myst:
17
17
 
18
18
  <!-- towncrier release notes start -->
19
19
 
20
+ ## 17.15.1 (2024-02-22)
21
+
22
+ ### Bugfix
23
+
24
+ - Fix sidebar form update. @robgietema [#5779](https://github.com/plone/volto/issues/5779)
25
+
20
26
  ## 17.15.0 (2024-02-21)
21
27
 
22
28
  ### Feature
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "17.15.0",
12
+ "version": "17.15.1",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git@github.com:plone/volto.git"
@@ -0,0 +1 @@
1
+ Fix sidebar form update. @robgietema
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plone/volto-slate",
3
- "version": "17.15.0",
3
+ "version": "17.15.1",
4
4
  "description": "Slate.js integration with Volto",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -5,7 +5,7 @@
5
5
 
6
6
  import React, { Component } from 'react';
7
7
  import PropTypes from 'prop-types';
8
- import { map, remove } from 'lodash';
8
+ import { isEmpty, map, remove } from 'lodash';
9
9
  import { Button, Table } from 'semantic-ui-react';
10
10
  import cx from 'classnames';
11
11
  import { defineMessages, injectIntl } from 'react-intl';
@@ -227,7 +227,7 @@ class Edit extends Component {
227
227
  * @returns {undefined}
228
228
  */
229
229
  componentDidMount() {
230
- if (!this.props.data.table) {
230
+ if (!this.props.data.table || isEmpty(this.props.data.table)) {
231
231
  this.props.onChangeBlock(this.props.block, {
232
232
  ...this.props.data,
233
233
  table: initialTable,
@@ -243,7 +243,7 @@ class Edit extends Component {
243
243
  * @returns {undefined}
244
244
  */
245
245
  UNSAFE_componentWillReceiveProps(nextProps) {
246
- if (!nextProps.data.table) {
246
+ if (!nextProps.data.table || isEmpty(nextProps.data.table)) {
247
247
  this.props.onChangeBlock(nextProps.block, {
248
248
  ...nextProps.data,
249
249
  table: initialTable,
@@ -528,10 +528,7 @@ class Edit extends Component {
528
528
  icon
529
529
  basic
530
530
  onClick={this.onDeleteRow}
531
- disabled={
532
- this.props.data.table &&
533
- this.props.data.table.rows.length === 1
534
- }
531
+ disabled={this.props.data.table?.rows?.length === 1}
535
532
  title={this.props.intl.formatMessage(messages.deleteRow)}
536
533
  aria-label={this.props.intl.formatMessage(messages.deleteRow)}
537
534
  >
@@ -569,10 +566,7 @@ class Edit extends Component {
569
566
  icon
570
567
  basic
571
568
  onClick={this.onDeleteCol}
572
- disabled={
573
- this.props.data.table &&
574
- this.props.data.table.rows[0].cells.length === 1
575
- }
569
+ disabled={this.props.data.table?.rows?.[0].cells.length === 1}
576
570
  title={this.props.intl.formatMessage(messages.deleteCol)}
577
571
  aria-label={this.props.intl.formatMessage(messages.deleteCol)}
578
572
  >
@@ -280,7 +280,7 @@ class Form extends Component {
280
280
  }
281
281
  if (
282
282
  this.props.global &&
283
- !isEqual(this.props.globalData, this.state.formData)
283
+ !isEqual(this.props.globalData, prevProps.globalData)
284
284
  ) {
285
285
  this.setState({
286
286
  formData: this.props.globalData,