mirror of https://github.com/alibaba/ice.git
feat: change suspense event id (#7057)
* feat: change suspense event id * chore: add missing change set
This commit is contained in:
parent
15cd5f7f6f
commit
a0099df51e
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@ice/runtime': patch
|
||||
---
|
||||
|
||||
feat: post event for each suspense.
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@ice/bundles': patch
|
||||
---
|
||||
|
||||
fix: update es-module-lexer
|
||||
|
|
@ -11,7 +11,7 @@ export default function Home() {
|
|||
<h2>Home Page</h2>
|
||||
<Counter />
|
||||
<Comments id="comments" fallback={<div>loading...</div>} />
|
||||
<Footer id="comments" fallback={<div>loading...</div>} />
|
||||
<Footer id="comments-2" fallback={<div>loading...</div>} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ export function withSuspense(Component) {
|
|||
<Data id={id} />
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `window.dispatchEvent(new CustomEvent('ice-suspense', { detail: { id: '${id}' } }));`,
|
||||
__html: `window.dispatchEvent(new CustomEvent('ice-suspense', { detail: { id: ${id ? `'${id}'` : undefined} } }));`,
|
||||
}}
|
||||
/>
|
||||
</SuspenseContext.Provider>
|
||||
|
|
@ -172,11 +172,9 @@ function Data(props) {
|
|||
|
||||
return (
|
||||
<script
|
||||
id={props.id ? `suspenseScript:${props.id}` : ''}
|
||||
id={props.id && `suspense-script-${props.id}`}
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `!function(){window['${LOADER}'] = window['${LOADER}'] || {};window['${LOADER}']['${
|
||||
props.id
|
||||
}'] = ${JSON.stringify(data)}}();`,
|
||||
__html: `!function(){window['${LOADER}'] = window['${LOADER}'] || {};window['${LOADER}']['${props.id}'] = ${JSON.stringify(data)}}();`,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue