@plone/volto-slate 19.0.1 → 19.0.2

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
@@ -8,6 +8,16 @@
8
8
 
9
9
  <!-- towncrier release notes start -->
10
10
 
11
+ ## 19.0.2 (2026-05-28)
12
+
13
+ ### Bugfix
14
+
15
+ - Fixed `redux-mock-store` used in production. @sneridagh
16
+
17
+ ### Internal
18
+
19
+ - Update devDependency: `@testing-library/react` 16.3.2. @wesleybl [#8294](https://github.com/plone/volto/issues/8294)
20
+
11
21
  ## 19.0.1 (2026-05-28)
12
22
 
13
23
  ### Documentation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plone/volto-slate",
3
- "version": "19.0.1",
3
+ "version": "19.0.2",
4
4
  "description": "Slate.js integration with Volto",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -29,7 +29,7 @@
29
29
  "react-redux": "8.1.2",
30
30
  "react-router-dom": "5.2.0",
31
31
  "react-toastify": "5.5.0",
32
- "redux-mock-store": "1.5.4",
32
+ "redux": "4.2.1",
33
33
  "semantic-ui-react": "2.1.5",
34
34
  "slate": "0.118.1",
35
35
  "slate-dom": "0.118.1",
@@ -40,8 +40,9 @@
40
40
  "weak-key": "^1.0.2"
41
41
  },
42
42
  "devDependencies": {
43
- "@testing-library/react": "14.3.1",
43
+ "@testing-library/react": "^16.3.2",
44
44
  "jsdom": "^28.1.0",
45
+ "redux-mock-store": "1.5.4",
45
46
  "release-it": "^20.0.1"
46
47
  },
47
48
  "peerDependencies": {
@@ -4,7 +4,6 @@
4
4
 
5
5
  import React from 'react';
6
6
  import ReactDOMServer from 'react-dom/server';
7
- import configureStore from 'redux-mock-store';
8
7
  import { MemoryRouter } from 'react-router-dom';
9
8
  import { Provider, useSelector } from 'react-redux';
10
9
  import { defineMessages, injectIntl, IntlProvider } from 'react-intl';
@@ -23,6 +22,7 @@ import {
23
22
  import config from '@plone/volto/registry';
24
23
 
25
24
  import { ErrorBoundary } from './ErrorBoundary';
25
+ import { createStaticStore } from './createStaticStore';
26
26
 
27
27
  import './style.css';
28
28
 
@@ -58,9 +58,8 @@ const HtmlSlateWidget = (props) => {
58
58
 
59
59
  const toHtml = React.useCallback(
60
60
  (value) => {
61
- const mockStore = configureStore();
62
61
  const html = ReactDOMServer.renderToStaticMarkup(
63
- <Provider store={mockStore({ userSession: { token } })}>
62
+ <Provider store={createStaticStore({ userSession: { token } })}>
64
63
  <IntlProvider
65
64
  locale={intl.locale}
66
65
  messages={intl.messages}
@@ -0,0 +1,4 @@
1
+ import { createStore } from 'redux';
2
+
3
+ export const createStaticStore = (state) =>
4
+ createStore((currentState = state) => currentState);
@@ -0,0 +1,20 @@
1
+ import { createStaticStore } from './createStaticStore';
2
+
3
+ describe('createStaticStore', () => {
4
+ it('provides a stable Redux store for static rendering', () => {
5
+ const state = { userSession: { token: 'secret-token' } };
6
+ const store = createStaticStore(state);
7
+ const listener = vi.fn();
8
+
9
+ const unsubscribe = store.subscribe(listener);
10
+
11
+ expect(store.getState()).toEqual(state);
12
+
13
+ store.dispatch({ type: 'IGNORED' });
14
+
15
+ expect(store.getState()).toEqual(state);
16
+ expect(listener).toHaveBeenCalledTimes(1);
17
+
18
+ unsubscribe();
19
+ });
20
+ });