@eeacms/volto-datahub 2.0.4 → 2.0.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.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ ### [2.0.5](https://github.com/eea/volto-datahub/compare/2.0.4...2.0.5) - 4 November 2025
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: error in itemView refs#291209, wrap inside ErrorBoundary [nileshgulia1 - [`b0ee8de`](https://github.com/eea/volto-datahub/commit/b0ee8ded47539f1119c96fcca98885d52700857e)]
12
+
7
13
  ### [2.0.4](https://github.com/eea/volto-datahub/compare/2.0.3...2.0.4) - 29 October 2025
8
14
 
9
15
  #### :bug: Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-datahub",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "@eeacms/volto-datahub: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -3,7 +3,7 @@ import { Portal } from 'react-portal';
3
3
  import { useDispatch, useSelector } from 'react-redux';
4
4
  import { Link, useLocation } from 'react-router-dom';
5
5
  import { Container, Icon, Button, Popup } from 'semantic-ui-react';
6
- import { Toolbar } from '@plone/volto/components';
6
+ import { Toolbar, ErrorBoundary } from '@plone/volto/components';
7
7
  import { BodyClass, asyncConnect, Helmet } from '@plone/volto/helpers';
8
8
  import config from '@plone/volto/registry';
9
9
  import { rebind, applyConfigurationSchema } from '@eeacms/search';
@@ -25,6 +25,9 @@ const WORD_COUNT = 60;
25
25
  const PROD_ID_COUNT = 3;
26
26
 
27
27
  const splitContent = (content, wordCount) => {
28
+ if (!content || typeof content !== 'string') {
29
+ return ['', ''];
30
+ }
28
31
  const words = content.split(' ');
29
32
  let firstTextPart = '',
30
33
  secondTextPart = '';
@@ -101,9 +104,10 @@ function ItemView(props) {
101
104
 
102
105
  const rawTitle = item && item._meta.found ? title?.raw || '' : docid;
103
106
 
104
- const splitDescription = description?.raw.split(' ').length > WORD_COUNT;
107
+ const descriptionText = description?.raw || '';
108
+ const splitDescription = descriptionText.split(' ').length > WORD_COUNT;
105
109
  const [firstTextPart, secondTextPart] = splitContent(
106
- description?.raw,
110
+ descriptionText,
107
111
  WORD_COUNT,
108
112
  );
109
113
  const [isReadMore, setIsReadMore] = React.useState(false);
@@ -251,7 +255,7 @@ function ItemView(props) {
251
255
  </Button>
252
256
  </p>
253
257
  ) : (
254
- <p>{description?.raw}</p>
258
+ <p>{descriptionText}</p>
255
259
  )}
256
260
  </Callout>
257
261
  </div>
@@ -278,21 +282,23 @@ function DatahubItemView(props) {
278
282
  const { staticContext = {} } = props;
279
283
 
280
284
  return (
281
- <div id="view">
282
- <BodyClass className="view-datahub-item" />
283
- <Container className="view-wrapper">
284
- <ItemView
285
- docid={docid}
286
- location={location}
287
- staticContext={staticContext}
288
- />
289
- </Container>
290
- {isClient && (
291
- <Portal node={document.getElementById('toolbar')}>
292
- <Toolbar pathname={props.pathname || ''} inner={<span />} />
293
- </Portal>
294
- )}
295
- </div>
285
+ <ErrorBoundary>
286
+ <div id="view">
287
+ <BodyClass className="view-datahub-item" />
288
+ <Container className="view-wrapper">
289
+ <ItemView
290
+ docid={docid}
291
+ location={location}
292
+ staticContext={staticContext}
293
+ />
294
+ </Container>
295
+ {isClient && (
296
+ <Portal node={document.getElementById('toolbar')}>
297
+ <Toolbar pathname={props.pathname || ''} inner={<span />} />
298
+ </Portal>
299
+ )}
300
+ </div>
301
+ </ErrorBoundary>
296
302
  );
297
303
  }
298
304
  export default asyncConnect([