Skip to content

Commit 2928447

Browse files
authored
feat: export head stream err recover script component (#6967)
* feat: export head stream err recover script component * fix: fix downgrade hostname * chore: update plugin-stream-error version * fix: head-stream-error independent export from plugin-stream-error * chore: changelog * chore: changelog
1 parent 60e8e5d commit 2928447

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

packages/plugin-stream-error/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@
55
### Major Changes
66

77
- f2c7df96: feat: plugin deal with stream error
8+
9+
## 1.0.1
10+
11+
### Patch Change
12+
13+
- feat: plugin export head stream error recover component

packages/plugin-stream-error/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ice/plugin-stream-error",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "",
55
"license": "MIT",
66
"type": "module",
@@ -9,7 +9,8 @@
99
"types": "./esm/index.d.ts",
1010
"import": "./esm/index.js",
1111
"default": "./esm/index.js"
12-
}
12+
},
13+
"./head-stream-error": "./esm/components/headStreamErrorRecoverScript.js"
1314
},
1415
"main": "./esm/index.js",
1516
"types": "./esm/index.d.ts",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react';
2+
3+
export default function HeadStreamErrorRecoverScript({ downgradeCSRHostname }) {
4+
return (
5+
<script
6+
dangerouslySetInnerHTML={{
7+
__html: `
8+
window.addEventListener('load', () => {
9+
if (!window._$ServerTimePoints && !window.__ICE_APP_CONTEXT__) {
10+
window.location.hostname = '${downgradeCSRHostname}';
11+
}
12+
})`,
13+
}
14+
}
15+
crossOrigin="anonymous"
16+
/>
17+
);
18+
}

0 commit comments

Comments
 (0)