@eeacms/volto-datahub 2.0.3 → 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,18 @@ 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
+
13
+ ### [2.0.4](https://github.com/eea/volto-datahub/compare/2.0.3...2.0.4) - 29 October 2025
14
+
15
+ #### :bug: Bug Fixes
16
+
17
+ - fix: datahub rss feeds - ref #293430 [Teodor Voicu - [`8b401ea`](https://github.com/eea/volto-datahub/commit/8b401ea6313ea4377cfbaf1a28249eea65fe8f2f)]
18
+
7
19
  ### [2.0.3](https://github.com/eea/volto-datahub/compare/2.0.2...2.0.3) - 23 October 2025
8
20
 
9
21
  #### :nail_care: Enhancements
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-datahub",
3
- "version": "2.0.3",
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);
@@ -136,36 +140,33 @@ function ItemView(props) {
136
140
  }, [item, dispatch, docid, rawTitle, currentUrl]);
137
141
 
138
142
  const intl = useIntl();
139
- const rssLinks = [
140
- {
141
- title: 'RSS',
142
- href: `${currentUrl}/datahub_rss.xml`,
143
- },
144
- ];
143
+ const rssLink = {
144
+ title: 'RSS',
145
+ href: `${currentUrl}/datahub_rss.xml`,
146
+ };
145
147
 
146
148
  return item && item._meta.found ? (
147
149
  <div className="dataset-view">
148
- <Helmet title={title?.raw} />
150
+ <Helmet
151
+ title={title?.raw}
152
+ link={[
153
+ {
154
+ rel: 'alternate',
155
+ title: rssLink.title ?? intl.formatMessage(messages.rssFeed),
156
+ href: rssLink.href,
157
+ type:
158
+ rssLink.feedType === 'atom'
159
+ ? 'application/atom+xml'
160
+ : 'application/rss+xml',
161
+ },
162
+ ]}
163
+ />
149
164
  <IsomorphicPortal>
150
165
  <div className="dataset">
151
166
  <Banner>
152
167
  <Banner.Content
153
- actions={rssLinks?.map((rssLink, index) => (
168
+ actions={
154
169
  <>
155
- <Helmet
156
- link={[
157
- {
158
- rel: 'alternate',
159
- title:
160
- rssLink.title ?? intl.formatMessage(messages.rssFeed),
161
- href: rssLink.href,
162
- type:
163
- rssLink.feedType === 'atom'
164
- ? 'application/atom+xml'
165
- : 'application/rss+xml',
166
- },
167
- ]}
168
- />
169
170
  <Banner.Action
170
171
  icon="ri-rss-fill"
171
172
  title={
@@ -176,7 +177,7 @@ function ItemView(props) {
176
177
  target="_blank"
177
178
  />
178
179
  </>
179
- ))}
180
+ }
180
181
  >
181
182
  <Banner.Subtitle>
182
183
  <Link to={appConfig.landingPageURL}>
@@ -254,7 +255,7 @@ function ItemView(props) {
254
255
  </Button>
255
256
  </p>
256
257
  ) : (
257
- <p>{description?.raw}</p>
258
+ <p>{descriptionText}</p>
258
259
  )}
259
260
  </Callout>
260
261
  </div>
@@ -281,21 +282,23 @@ function DatahubItemView(props) {
281
282
  const { staticContext = {} } = props;
282
283
 
283
284
  return (
284
- <div id="view">
285
- <BodyClass className="view-datahub-item" />
286
- <Container className="view-wrapper">
287
- <ItemView
288
- docid={docid}
289
- location={location}
290
- staticContext={staticContext}
291
- />
292
- </Container>
293
- {isClient && (
294
- <Portal node={document.getElementById('toolbar')}>
295
- <Toolbar pathname={props.pathname || ''} inner={<span />} />
296
- </Portal>
297
- )}
298
- </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>
299
302
  );
300
303
  }
301
304
  export default asyncConnect([
@@ -223,10 +223,14 @@ export default function makeMiddlewares(config) {
223
223
  middleware.use(express.urlencoded({ extended: true }));
224
224
 
225
225
  middleware.all('**/datahub/sitemap-data.xml', sitemap);
226
+ // Original landing page RSS route (restored for backwards compatibility)
227
+ middleware.all('**/datahub/rss.xml', make_rssMiddleware(config, generateRSS));
228
+ // Alternative landing page RSS route
226
229
  middleware.all(
227
230
  '**/datahub/datahub_rss.xml',
228
231
  make_rssMiddleware(config, generateRSS),
229
232
  );
233
+ // Per-item RSS route
230
234
  middleware.all(
231
235
  `**/datahub/${viewRouteId}/:id/${rssRouteId}`,
232
236
  make_rssMiddleware(config, generateItemRSS),
package/src/index.js CHANGED
@@ -41,6 +41,8 @@ const applyConfig = (config) => {
41
41
  config.settings.nonContentRoutes.push(
42
42
  new RegExp(`/.+/datahub/${rssRouteIdRegexp}`),
43
43
  );
44
+ // Original landing page RSS route
45
+ config.settings.nonContentRoutes.push(new RegExp(`/.+/datahub/rss\\.xml`));
44
46
 
45
47
  config.settings.externalRoutes.push({
46
48
  match: {
@@ -49,6 +51,14 @@ const applyConfig = (config) => {
49
51
  exact: true,
50
52
  },
51
53
  });
54
+ // Original landing page RSS route
55
+ config.settings.externalRoutes.push({
56
+ match: {
57
+ path: new RegExp(`/.+/datahub/rss\\.xml`),
58
+ strict: true,
59
+ exact: true,
60
+ },
61
+ });
52
62
  config.addonRoutes = [
53
63
  {
54
64
  path: `*/${viewRouteId}/:id`,