@plone/volto 16.30.2 → 16.30.3

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/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "16.30.2",
12
+ "version": "16.30.3",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git@github.com:plone/volto.git"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plone/volto-slate",
3
- "version": "16.30.2",
3
+ "version": "16.30.3",
4
4
  "description": "Slate.js integration with Volto",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -1,14 +1,29 @@
1
1
  import { getQueryStringResults } from '@plone/volto/actions';
2
2
  import { resolveBlockExtensions } from '@plone/volto/helpers';
3
+ import qs from 'query-string';
4
+ import { slugify } from '@plone/volto/helpers/Utils/Utils';
5
+
6
+ const getCurrentPage = (location, id) => {
7
+ const pageQueryParam = qs.parse(location.search);
8
+ switch (Object.keys(pageQueryParam).length) {
9
+ case 0:
10
+ return 1;
11
+ case 1:
12
+ // when there is only one query param, it could be the simple page number or the sluggified block id
13
+ return pageQueryParam['page'] || pageQueryParam[slugify(`page-${id}`)];
14
+ default:
15
+ return pageQueryParam[slugify(`page-${id}`)];
16
+ }
17
+ };
18
+
19
+ export default function getListingBlockAsyncData(props) {
20
+ const { data, path, location, id, dispatch, blocksConfig, content } = props;
3
21
 
4
- export default function getListingBlockAsyncData({
5
- dispatch,
6
- data,
7
- path,
8
- blocksConfig,
9
- }) {
10
22
  const { resolvedExtensions } = resolveBlockExtensions(data, blocksConfig);
11
23
 
24
+ const subrequestID = content?.UID ? `${content?.UID}-${id}` : id;
25
+ const currentPage = getCurrentPage(location, id);
26
+
12
27
  return [
13
28
  dispatch(
14
29
  getQueryStringResults(
@@ -19,7 +34,8 @@ export default function getListingBlockAsyncData({
19
34
  ? { fullobjects: 1 }
20
35
  : { metadata_fields: '_all' }),
21
36
  },
22
- data.block,
37
+ subrequestID,
38
+ currentPage,
23
39
  ),
24
40
  ),
25
41
  ];
@@ -242,6 +242,7 @@ export const fetchContent = async ({ store, location }) => {
242
242
  id,
243
243
  data,
244
244
  blocksConfig,
245
+ content,
245
246
  });
246
247
  if (!p?.length) {
247
248
  throw new Error(