Skip to content

Commit 51542c9

Browse files
committed
Dynamic import Account Center
1 parent 3c4d38d commit 51542c9

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

packages/core/src/views/Index.svelte

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import Connect from './connect/Index.svelte'
66
import SwitchChain from './chain/SwitchChain.svelte'
77
import ActionRequired from './connect/ActionRequired.svelte'
8-
import AccountCenter from './account-center/Index.svelte'
98
import Notify from './notify/Index.svelte'
109
import { configuration } from '../configuration'
1110
import type { Observable } from 'rxjs'
@@ -43,6 +42,10 @@
4342
}
4443
}
4544
45+
const accountCenterComponent = $accountCenter$.enabled
46+
? import('./account-center/Index.svelte').then(mod => mod.default)
47+
: Promise.resolve(null)
48+
4649
$: sharedContainer =
4750
$accountCenter$.enabled &&
4851
$notify$.enabled &&
@@ -376,7 +379,11 @@
376379
? 'margin-right: auto'
377380
: ''}
378381
>
379-
<AccountCenter settings={$accountCenter$} />
382+
{#await accountCenterComponent then AccountCenter}
383+
{#if AccountCenter}
384+
<svelte:component this={AccountCenter} settings={$accountCenter$} />
385+
{/if}
386+
{/await}
380387
</div>
381388
{#if $notify$.position.includes('top') && $accountCenter$.position.includes('top') && samePositionOrMobile}
382389
<Notify
@@ -410,7 +417,11 @@
410417
: ''}
411418
>
412419
{#if $accountCenter$.enabled && $wallets$.length}
413-
<AccountCenter settings={$accountCenter$} />
420+
{#await accountCenterComponent then AccountCenter}
421+
{#if AccountCenter}
422+
<svelte:component this={AccountCenter} settings={$accountCenter$} />
423+
{/if}
424+
{/await}
414425
{/if}
415426
</div>
416427
</div>

0 commit comments

Comments
 (0)