Skip to content

Commit

Permalink
feat: export head stream err recover script component (#6967)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
wjn760371 authored Aug 14, 2024
1 parent 60e8e5d commit 2928447
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
6 changes: 6 additions & 0 deletions packages/plugin-stream-error/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@
### Major Changes

- f2c7df96: feat: plugin deal with stream error

## 1.0.1

### Patch Change

- feat: plugin export head stream error recover component
5 changes: 3 additions & 2 deletions packages/plugin-stream-error/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ice/plugin-stream-error",
"version": "1.0.0",
"version": "1.0.1",
"description": "",
"license": "MIT",
"type": "module",
Expand All @@ -9,7 +9,8 @@
"types": "./esm/index.d.ts",
"import": "./esm/index.js",
"default": "./esm/index.js"
}
},
"./head-stream-error": "./esm/components/headStreamErrorRecoverScript.js"
},
"main": "./esm/index.js",
"types": "./esm/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';

export default function HeadStreamErrorRecoverScript({ downgradeCSRHostname }) {
return (
<script
dangerouslySetInnerHTML={{
__html: `
window.addEventListener('load', () => {
if (!window._$ServerTimePoints && !window.__ICE_APP_CONTEXT__) {
window.location.hostname = '${downgradeCSRHostname}';
}
})`,
}
}

Check failure on line 14 in packages/plugin-stream-error/src/components/headStreamErrorRecoverScript.tsx

View workflow job for this annotation

GitHub Actions / build (16.x, ubuntu-latest)

Unexpected newline before '}'

Check failure on line 14 in packages/plugin-stream-error/src/components/headStreamErrorRecoverScript.tsx

View workflow job for this annotation

GitHub Actions / build (16.x, windows-latest)

Unexpected newline before '}'

Check failure on line 14 in packages/plugin-stream-error/src/components/headStreamErrorRecoverScript.tsx

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-latest)

Unexpected newline before '}'

Check failure on line 14 in packages/plugin-stream-error/src/components/headStreamErrorRecoverScript.tsx

View workflow job for this annotation

GitHub Actions / build (18.x, windows-latest)

Unexpected newline before '}'
crossOrigin="anonymous"
/>
);
}
File renamed without changes.

0 comments on commit 2928447

Please sign in to comment.