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>
|
<h2>Home Page</h2>
|
||||||
<Counter />
|
<Counter />
|
||||||
<Comments id="comments" fallback={<div>loading...</div>} />
|
<Comments id="comments" fallback={<div>loading...</div>} />
|
||||||
<Footer id="comments" fallback={<div>loading...</div>} />
|
<Footer id="comments-2" fallback={<div>loading...</div>} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ export function withSuspense(Component) {
|
||||||
<Data id={id} />
|
<Data id={id} />
|
||||||
<script
|
<script
|
||||||
dangerouslySetInnerHTML={{
|
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>
|
</SuspenseContext.Provider>
|
||||||
|
|
@ -172,11 +172,9 @@ function Data(props) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<script
|
<script
|
||||||
id={props.id ? `suspenseScript:${props.id}` : ''}
|
id={props.id && `suspense-script-${props.id}`}
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: `!function(){window['${LOADER}'] = window['${LOADER}'] || {};window['${LOADER}']['${
|
__html: `!function(){window['${LOADER}'] = window['${LOADER}'] || {};window['${LOADER}']['${props.id}'] = ${JSON.stringify(data)}}();`,
|
||||||
props.id
|
|
||||||
}'] = ${JSON.stringify(data)}}();`,
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue