perf: lazy-load the ComposeBox (#1262)
This commit is contained in:
parent
d75507bbce
commit
58a8772edc
|
@ -7,7 +7,7 @@
|
||||||
{#if hidePage}
|
{#if hidePage}
|
||||||
<LoadingPage />
|
<LoadingPage />
|
||||||
{/if}
|
{/if}
|
||||||
<ComposeBox realm="home" hidden={hidePage}/>
|
<LazyComposeBox realm="home" hidden={hidePage}/>
|
||||||
<div class="timeline-home-anchor-container">
|
<div class="timeline-home-anchor-container">
|
||||||
{#if !hidePage && hideTimeline}
|
{#if !hidePage && hideTimeline}
|
||||||
<LoadingPage />
|
<LoadingPage />
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
import LazyTimeline from './timeline/LazyTimeline.html'
|
import LazyTimeline from './timeline/LazyTimeline.html'
|
||||||
import { store } from '../_store/store.js'
|
import { store } from '../_store/store.js'
|
||||||
import LoadingPage from './LoadingPage.html'
|
import LoadingPage from './LoadingPage.html'
|
||||||
import ComposeBox from './compose/ComposeBox.html'
|
import LazyComposeBox from './compose/LazyComposeBox.html'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
oncreate () {
|
oncreate () {
|
||||||
|
@ -44,9 +44,9 @@
|
||||||
},
|
},
|
||||||
store: () => store,
|
store: () => store,
|
||||||
components: {
|
components: {
|
||||||
|
LazyComposeBox,
|
||||||
LazyTimeline,
|
LazyTimeline,
|
||||||
LoadingPage,
|
LoadingPage
|
||||||
ComposeBox
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
16
src/routes/_components/compose/LazyComposeBox.html
Normal file
16
src/routes/_components/compose/LazyComposeBox.html
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{#await importComposeBox}
|
||||||
|
<!-- awaiting promise -->
|
||||||
|
{:then ComposeBox}
|
||||||
|
<svelte:component this={ComposeBox} {realm} {hidden} />
|
||||||
|
{:catch error}
|
||||||
|
<div>Component failed to load. Try refreshing! {error}</div>
|
||||||
|
{/await}
|
||||||
|
<script>
|
||||||
|
import { importComposeBox } from '../../_utils/asyncModules'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data: () => ({
|
||||||
|
importComposeBox: importComposeBox()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -43,3 +43,7 @@ export const importToast = () => import(
|
||||||
export const importSnackbar = () => import(
|
export const importSnackbar = () => import(
|
||||||
/* webpackChunkName: 'Snackbar.html' */ '../_components/snackbar/Snackbar.html'
|
/* webpackChunkName: 'Snackbar.html' */ '../_components/snackbar/Snackbar.html'
|
||||||
).then(getDefault)
|
).then(getDefault)
|
||||||
|
|
||||||
|
export const importComposeBox = () => import(
|
||||||
|
/* webpackChunkName: 'ComposeBox.html' */ '../_components/compose/ComposeBox.html'
|
||||||
|
).then(getDefault)
|
||||||
|
|
Loading…
Reference in a new issue