@tramvai/module-render 2.108.1 → 2.109.1

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.
@@ -1,11 +1,12 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { Provider } from '@tramvai/state';
3
3
  import { DIContext } from '@tramvai/react';
4
+ import { INITIAL_APP_STATE_TOKEN } from '@tramvai/tokens-common';
4
5
  import { Root } from './root.browser.js';
5
6
 
6
7
  function renderReact({ di }, context) {
7
- const serverState = typeof window !== 'undefined' ? context.getState() : undefined;
8
- return (jsx(Provider, { context: context, serverState: serverState, children: jsx(DIContext.Provider, { value: di, children: jsx(Root, {}) }) }));
8
+ const initialState = di.get({ token: INITIAL_APP_STATE_TOKEN, optional: true });
9
+ return (jsx(Provider, { context: context, serverState: initialState === null || initialState === void 0 ? void 0 : initialState.stores, children: jsx(DIContext.Provider, { value: di, children: jsx(Root, {}) }) }));
9
10
  }
10
11
 
11
12
  export { renderReact };
@@ -1,3 +1,4 @@
1
+ import type { DI_TOKEN } from '@tinkoff/dippy';
1
2
  export declare function renderReact({ di }: {
2
- di: any;
3
+ di: typeof DI_TOKEN;
3
4
  }, context: any): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,12 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { Provider } from '@tramvai/state';
3
3
  import { DIContext } from '@tramvai/react';
4
+ import { INITIAL_APP_STATE_TOKEN } from '@tramvai/tokens-common';
4
5
  import { Root } from './root.es.js';
5
6
 
6
7
  function renderReact({ di }, context) {
7
- const serverState = typeof window !== 'undefined' ? context.getState() : undefined;
8
- return (jsx(Provider, { context: context, serverState: serverState, children: jsx(DIContext.Provider, { value: di, children: jsx(Root, {}) }) }));
8
+ const initialState = di.get({ token: INITIAL_APP_STATE_TOKEN, optional: true });
9
+ return (jsx(Provider, { context: context, serverState: initialState === null || initialState === void 0 ? void 0 : initialState.stores, children: jsx(DIContext.Provider, { value: di, children: jsx(Root, {}) }) }));
9
10
  }
10
11
 
11
12
  export { renderReact };
@@ -5,11 +5,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var state = require('@tramvai/state');
7
7
  var react = require('@tramvai/react');
8
+ var tokensCommon = require('@tramvai/tokens-common');
8
9
  var root = require('./root.js');
9
10
 
10
11
  function renderReact({ di }, context) {
11
- const serverState = typeof window !== 'undefined' ? context.getState() : undefined;
12
- return (jsxRuntime.jsx(state.Provider, { context: context, serverState: serverState, children: jsxRuntime.jsx(react.DIContext.Provider, { value: di, children: jsxRuntime.jsx(root.Root, {}) }) }));
12
+ const initialState = di.get({ token: tokensCommon.INITIAL_APP_STATE_TOKEN, optional: true });
13
+ return (jsxRuntime.jsx(state.Provider, { context: context, serverState: initialState === null || initialState === void 0 ? void 0 : initialState.stores, children: jsxRuntime.jsx(react.DIContext.Provider, { value: di, children: jsxRuntime.jsx(root.Root, {}) }) }));
13
14
  }
14
15
 
15
16
  exports.renderReact = renderReact;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-render",
3
- "version": "2.108.1",
3
+ "version": "2.109.1",
4
4
  "description": "",
5
5
  "browser": "lib/browser.js",
6
6
  "main": "lib/server.js",
@@ -26,13 +26,13 @@
26
26
  "@tinkoff/layout-factory": "0.3.8",
27
27
  "@tinkoff/errors": "0.3.8",
28
28
  "@tinkoff/url": "0.8.6",
29
- "@tinkoff/user-agent": "0.4.308",
30
- "@tramvai/module-client-hints": "2.108.1",
31
- "@tramvai/module-router": "2.108.1",
32
- "@tramvai/react": "2.108.1",
29
+ "@tinkoff/user-agent": "0.4.310",
30
+ "@tramvai/module-client-hints": "2.109.1",
31
+ "@tramvai/module-router": "2.109.1",
32
+ "@tramvai/react": "2.109.1",
33
33
  "@tramvai/safe-strings": "0.5.9",
34
- "@tramvai/tokens-render": "2.108.1",
35
- "@tramvai/experiments": "2.108.1",
34
+ "@tramvai/tokens-render": "2.109.1",
35
+ "@tramvai/experiments": "2.109.1",
36
36
  "@types/loadable__server": "^5.12.6",
37
37
  "node-fetch": "^2.6.1"
38
38
  },
@@ -40,14 +40,14 @@
40
40
  "@tinkoff/dippy": "0.8.15",
41
41
  "@tinkoff/utils": "^2.1.2",
42
42
  "@tinkoff/react-hooks": "0.1.6",
43
- "@tramvai/cli": "2.108.1",
44
- "@tramvai/core": "2.108.1",
45
- "@tramvai/module-common": "2.108.1",
46
- "@tramvai/state": "2.108.1",
47
- "@tramvai/test-helpers": "2.108.1",
48
- "@tramvai/tokens-common": "2.108.1",
49
- "@tramvai/tokens-router": "2.108.1",
50
- "@tramvai/tokens-server-private": "2.108.1",
43
+ "@tramvai/cli": "2.109.1",
44
+ "@tramvai/core": "2.109.1",
45
+ "@tramvai/module-common": "2.109.1",
46
+ "@tramvai/state": "2.109.1",
47
+ "@tramvai/test-helpers": "2.109.1",
48
+ "@tramvai/tokens-common": "2.109.1",
49
+ "@tramvai/tokens-router": "2.109.1",
50
+ "@tramvai/tokens-server-private": "2.109.1",
51
51
  "express": "^4.17.1",
52
52
  "prop-types": "^15.6.2",
53
53
  "react": ">=16.14.0",