Skip to content

Commit 5d972de

Browse files
committed
Dynamically import notify
1 parent 51542c9 commit 5d972de

File tree

1 file changed

+34
-15
lines changed

1 file changed

+34
-15
lines changed

packages/core/src/views/Index.svelte

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
? import('./account-center/Index.svelte').then(mod => mod.default)
4747
: Promise.resolve(null)
4848
49+
const notifyComponent = $notify$.enabled
50+
? import('./notify/Index.svelte').then(mod => mod.default)
51+
: Promise.resolve(null)
52+
4953
$: sharedContainer =
5054
$accountCenter$.enabled &&
5155
$notify$.enabled &&
@@ -362,11 +366,16 @@
362366
: ''} "
363367
>
364368
{#if $notify$.position.includes('bottom') && $accountCenter$.position.includes('bottom') && samePositionOrMobile}
365-
<Notify
366-
notifications={$notifications$}
367-
position={$notify$.position}
368-
{sharedContainer}
369-
/>
369+
{#await notifyComponent then Notify}
370+
{#if Notify}
371+
<svelte:component
372+
this={Notify}
373+
notifications={$notifications$}
374+
position={$notify$.position}
375+
{sharedContainer}
376+
/>
377+
{/if}
378+
{/await}
370379
{/if}
371380
<div
372381
style={!$accountCenter$.expanded &&
@@ -386,11 +395,16 @@
386395
{/await}
387396
</div>
388397
{#if $notify$.position.includes('top') && $accountCenter$.position.includes('top') && samePositionOrMobile}
389-
<Notify
390-
notifications={$notifications$}
391-
position={$notify$.position}
392-
{sharedContainer}
393-
/>
398+
{#await notifyComponent then Notify}
399+
{#if Notify}
400+
<svelte:component
401+
this={Notify}
402+
notifications={$notifications$}
403+
position={$notify$.position}
404+
{sharedContainer}
405+
/>
406+
{/if}
407+
{/await}
394408
{/if}
395409
</div>
396410
{/if}
@@ -437,10 +451,15 @@
437451
? 'padding-top:0;'
438452
: ''} "
439453
>
440-
<Notify
441-
notifications={$notifications$}
442-
position={$notify$.position}
443-
{sharedContainer}
444-
/>
454+
{#await notifyComponent then Notify}
455+
{#if Notify}
456+
<svelte:component
457+
this={Notify}
458+
notifications={$notifications$}
459+
position={$notify$.position}
460+
{sharedContainer}
461+
/>
462+
{/if}
463+
{/await}
445464
</div>
446465
{/if}

0 commit comments

Comments
 (0)