@kitconcept/volto-light-theme 6.0.0-alpha.4 → 6.0.0-alpha.5

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.draft CHANGED
@@ -1,7 +1,11 @@
1
- ## 6.0.0-alpha.4 (2024-12-08)
1
+ ## 6.0.0-alpha.5 (2024-12-09)
2
2
 
3
3
  ### Bugfix
4
4
 
5
- - Fix initialBlocks config, do not override the whole thing. @sneridagh [#441](https://github.com/kitconcept/volto-light-theme/pull/441)
5
+ - Added guard in case blocks are corrupted or malformed. @sneridagh [#442](https://github.com/kitconcept/volto-light-theme/pull/442)
6
+
7
+ ### Internal
8
+
9
+ - Updated to latest 18.2.2 @sneridagh [#443](https://github.com/kitconcept/volto-light-theme/pull/443)
6
10
 
7
11
 
package/CHANGELOG.md CHANGED
@@ -8,6 +8,16 @@
8
8
 
9
9
  <!-- towncrier release notes start -->
10
10
 
11
+ ## 6.0.0-alpha.5 (2024-12-09)
12
+
13
+ ### Bugfix
14
+
15
+ - Added guard in case blocks are corrupted or malformed. @sneridagh [#442](https://github.com/kitconcept/volto-light-theme/pull/442)
16
+
17
+ ### Internal
18
+
19
+ - Updated to latest 18.2.2 @sneridagh [#443](https://github.com/kitconcept/volto-light-theme/pull/443)
20
+
11
21
  ## 6.0.0-alpha.4 (2024-12-08)
12
22
 
13
23
  ### Bugfix
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitconcept/volto-light-theme",
3
- "version": "6.0.0-alpha.4",
3
+ "version": "6.0.0-alpha.5",
4
4
  "description": "Volto Light Theme by kitconcept",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/types/index.d.ts",
@@ -21,7 +21,8 @@ import {
21
21
  findStyleByName,
22
22
  } from '@plone/volto/helpers/Blocks/Blocks';
23
23
  import { defineMessages, useIntl } from 'react-intl';
24
- import { map } from 'lodash';
24
+ import map from 'lodash/map';
25
+ import isEmpty from 'lodash/isEmpty';
25
26
  import StyleWrapper from '@plone/volto/components/manage/Blocks/Block/StyleWrapper';
26
27
  import config from '@plone/volto/registry';
27
28
  import ViewDefaultBlock from '@plone/volto/components/manage/Blocks/Block/DefaultView';
@@ -45,6 +46,11 @@ export function groupByBGColor(blocks, blocks_layout, colorDefinitions) {
45
46
  let currentArr = [];
46
47
  let currentBGColor;
47
48
 
49
+ // Guard in case the block layout is empty or corrupted for some reason
50
+ if (blocks_layout.items.length === 0 || isEmpty(blocks)) {
51
+ return [];
52
+ }
53
+
48
54
  blocks_layout.items.forEach((blockId) => {
49
55
  let currentBlockColor = blocks[blockId]?.theme || 'default';
50
56
  if (currentBlockColor !== currentBGColor) {