@tramvai/module-render 2.48.3 → 2.49.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/lib/browser.js +18 -5
- package/package.json +15 -15
package/lib/browser.js
CHANGED
|
@@ -10,6 +10,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
10
10
|
import { createEvent, createReducer, useStore, Provider } from '@tramvai/state';
|
|
11
11
|
import { useDi, ERROR_BOUNDARY_TOKEN, ERROR_BOUNDARY_FALLBACK_COMPONENT_TOKEN, UniversalErrorBoundary, DIContext } from '@tramvai/react';
|
|
12
12
|
import { usePageService, useUrl } from '@tramvai/module-router';
|
|
13
|
+
import debounce from '@tinkoff/utils/function/debounce';
|
|
13
14
|
import { useIsomorphicLayoutEffect } from '@tinkoff/react-hooks';
|
|
14
15
|
import { composeLayoutOptions, createLayout } from '@tinkoff/layout-factory';
|
|
15
16
|
|
|
@@ -115,14 +116,26 @@ const ExecuteRenderCallback = ({ children, callback, }) => {
|
|
|
115
116
|
const renderer = ({ element, container, callback, log }) => {
|
|
116
117
|
if (process.env.__TRAMVAI_CONCURRENT_FEATURES && typeof hydrateRoot === 'function') {
|
|
117
118
|
const wrappedElement = createElement(ExecuteRenderCallback, { callback }, element);
|
|
119
|
+
let allErrors = new Map();
|
|
120
|
+
const logHydrateRecoverableError = debounce(50, () => {
|
|
121
|
+
if (allErrors.size === 0) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const [{ error, errorInfo }, ...otherErrors] = Array.from(allErrors.values());
|
|
125
|
+
allErrors = new Map();
|
|
126
|
+
log.error({
|
|
127
|
+
event: 'hydrate:recover-after-error',
|
|
128
|
+
error,
|
|
129
|
+
errorInfo,
|
|
130
|
+
otherErrors,
|
|
131
|
+
});
|
|
132
|
+
});
|
|
118
133
|
return startTransition(() => {
|
|
119
134
|
hydrateRoot(container, wrappedElement, {
|
|
120
135
|
onRecoverableError: (error, errorInfo) => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
errorInfo,
|
|
125
|
-
});
|
|
136
|
+
// deduplicate by unique important string values
|
|
137
|
+
allErrors.set((error === null || error === void 0 ? void 0 : error.message) + (errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.componentStack), { error, errorInfo });
|
|
138
|
+
logHydrateRecoverableError();
|
|
126
139
|
},
|
|
127
140
|
});
|
|
128
141
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-render",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.49.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"browser": "lib/browser.js",
|
|
6
6
|
"main": "lib/server.js",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"@tinkoff/htmlpagebuilder": "0.5.5",
|
|
27
27
|
"@tinkoff/layout-factory": "0.3.4",
|
|
28
28
|
"@tinkoff/url": "0.8.4",
|
|
29
|
-
"@tinkoff/user-agent": "0.4.
|
|
30
|
-
"@tramvai/module-client-hints": "2.
|
|
31
|
-
"@tramvai/module-router": "2.
|
|
32
|
-
"@tramvai/react": "2.
|
|
29
|
+
"@tinkoff/user-agent": "0.4.115",
|
|
30
|
+
"@tramvai/module-client-hints": "2.49.2",
|
|
31
|
+
"@tramvai/module-router": "2.49.2",
|
|
32
|
+
"@tramvai/react": "2.49.2",
|
|
33
33
|
"@tramvai/safe-strings": "0.5.6",
|
|
34
|
-
"@tramvai/tokens-render": "2.
|
|
35
|
-
"@tramvai/experiments": "2.
|
|
34
|
+
"@tramvai/tokens-render": "2.49.2",
|
|
35
|
+
"@tramvai/experiments": "2.49.2",
|
|
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.9",
|
|
41
41
|
"@tinkoff/utils": "^2.1.2",
|
|
42
42
|
"@tinkoff/react-hooks": "0.1.4",
|
|
43
|
-
"@tramvai/cli": "2.
|
|
44
|
-
"@tramvai/core": "2.
|
|
45
|
-
"@tramvai/module-common": "2.
|
|
46
|
-
"@tramvai/state": "2.
|
|
47
|
-
"@tramvai/test-helpers": "2.
|
|
48
|
-
"@tramvai/tokens-common": "2.
|
|
49
|
-
"@tramvai/tokens-router": "2.
|
|
50
|
-
"@tramvai/tokens-server-private": "2.
|
|
43
|
+
"@tramvai/cli": "2.49.2",
|
|
44
|
+
"@tramvai/core": "2.49.2",
|
|
45
|
+
"@tramvai/module-common": "2.49.2",
|
|
46
|
+
"@tramvai/state": "2.49.2",
|
|
47
|
+
"@tramvai/test-helpers": "2.49.2",
|
|
48
|
+
"@tramvai/tokens-common": "2.49.2",
|
|
49
|
+
"@tramvai/tokens-router": "2.49.2",
|
|
50
|
+
"@tramvai/tokens-server-private": "2.49.2",
|
|
51
51
|
"express": "^4.17.1",
|
|
52
52
|
"prop-types": "^15.6.2",
|
|
53
53
|
"react": ">=16.14.0",
|