make PseudoVirtualList sync rather than async (#133)

Attempt to address #92
This commit is contained in:
Nolan Lawson 2018-04-15 14:43:41 -07:00 committed by GitHub
parent ee43de9e5e
commit e23aa97cf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 25 deletions

View File

@ -22,11 +22,9 @@
on:noNeedToScroll="onNoNeedToScroll()" on:noNeedToScroll="onNoNeedToScroll()"
/> />
{{else}} {{else}}
{{#await importPseudoVirtualList}}
{{then PseudoVirtualList}}
<!-- if this is a status thread, it's easier to just render the <!-- if this is a status thread, it's easier to just render the
whole thing rather than use a virtual list --> whole thing rather than use a virtual list -->
<:Component {PseudoVirtualList} <PseudoVirtualList
component="{{VirtualListComponent}}" component="{{VirtualListComponent}}"
realm="{{$currentInstance + '/' + timeline}}" realm="{{$currentInstance + '/' + timeline}}"
containerQuery=".container" containerQuery=".container"
@ -35,9 +33,6 @@
scrollToItem="{{scrollToItem}}" scrollToItem="{{scrollToItem}}"
on:initialized="initialize()" on:initialized="initialize()"
/> />
{{catch error}}
<div>Component failed to load. Try refreshing! {{error}}</div>
{{/await}}
{{/if}} {{/if}}
</div> </div>
<script> <script>
@ -48,6 +43,7 @@
import LoadingFooter from './LoadingFooter.html' import LoadingFooter from './LoadingFooter.html'
import MoreHeaderVirtualWrapper from './MoreHeaderVirtualWrapper.html' import MoreHeaderVirtualWrapper from './MoreHeaderVirtualWrapper.html'
import VirtualList from '../virtualList/VirtualList.html' import VirtualList from '../virtualList/VirtualList.html'
import PseudoVirtualList from '../pseudoVirtualList/PseudoVirtualList.html'
import { timelines } from '../../_static/timelines' import { timelines } from '../../_static/timelines'
import { database } from '../../_database/database' import { database } from '../../_database/database'
import { import {
@ -60,7 +56,6 @@
import { focusWithCapture, blurWithCapture } from '../../_utils/events' import { focusWithCapture, blurWithCapture } from '../../_utils/events'
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask' import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
import { mark, stop } from '../../_utils/marks' import { mark, stop } from '../../_utils/marks'
import { importPseudoVirtualList } from '../../_utils/asyncModules'
import isEqual from 'lodash-es/isEqual' import isEqual from 'lodash-es/isEqual'
import { doubleRAF } from '../../_utils/doubleRAF' import { doubleRAF } from '../../_utils/doubleRAF'
@ -83,9 +78,6 @@
scrollTop: 0 scrollTop: 0
}), }),
computed: { computed: {
importPseudoVirtualList: (virtual) => {
return !virtual && importPseudoVirtualList()
},
VirtualListComponent: (timelineType) => { VirtualListComponent: (timelineType) => {
return timelineType === 'notifications' ? NotificationVirtualListItem : StatusVirtualListItem return timelineType === 'notifications' ? NotificationVirtualListItem : StatusVirtualListItem
}, },
@ -146,7 +138,8 @@
}, },
store: () => store, store: () => store,
components: { components: {
VirtualList VirtualList,
PseudoVirtualList
}, },
events: { events: {
focusWithCapture, focusWithCapture,

View File

@ -22,10 +22,6 @@ export const importWebSocketClient = () => import(
/* webpackChunkName: '@gamestdio/websocket' */ '@gamestdio/websocket' /* webpackChunkName: '@gamestdio/websocket' */ '@gamestdio/websocket'
).then(mod => mod.default) ).then(mod => mod.default)
export const importPseudoVirtualList = () => import(
/* webpackChunkName: 'PseudoVirtualList' */ '../_components/pseudoVirtualList/PseudoVirtualList.html'
).then(mod => mod.default)
export const importDialogs = () => import( export const importDialogs = () => import(
/* webpackChunkName: 'dialogs' */ '../_components/dialog/dialogs.js' /* webpackChunkName: 'dialogs' */ '../_components/dialog/dialogs.js'
) )