Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use virtual scrolling for the polls list #3488

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"vue": "^2.7.15",
"vue-material-design-icons": "^5.3.0",
"vue-router": "^3.6.5",
"vue-virtual-scroller": "^1.1.2",
"vuedraggable": "^2.24.3",
"vuex": "^3.6.2",
"vuex-router-sync": "^5.0.0",
Expand Down
28 changes: 21 additions & 7 deletions src/js/views/PollList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@
</HeaderBar>

<div class="area__main">
<TransitionGroup tag="div" name="list" class="poll-list__list">
<PollItem key="0" :header="true" @sort-list="setSortColumn($event)" />
<PollItem key="0" :header="true" @sort-list="setSortColumn($event)" />

<RecycleScroller v-if="!emptyPollListnoPolls"
:items="pollList"
:item-size="73"
key-field="id">
<template #default="{ item: poll }">
<PollItem :poll="poll"

<template v-if="!emptyPollListnoPolls">
<PollItem v-for="(poll) in pollList"
:key="poll.id"
:poll="poll"
@goto-poll="gotoPoll(poll.id)"
@load-poll="loadPoll(poll.id)">
<template #actions>
Expand Down Expand Up @@ -81,7 +83,7 @@
</template>
</PollItem>
</template>
</TransitionGroup>
</RecycleScroller>

<IntersectionObserver v-if="showMore"
artonge marked this conversation as resolved.
Show resolved Hide resolved
key="observer"
Expand Down Expand Up @@ -113,6 +115,8 @@ import ClonePollIcon from 'vue-material-design-icons/ContentCopy.vue'
import ArchivePollIcon from 'vue-material-design-icons/Archive.vue'
import RestorePollIcon from 'vue-material-design-icons/Recycle.vue'
import { PollsAppIcon } from '../components/AppIcons/index.js'
import { RecycleScroller } from 'vue-virtual-scroller'
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'

export default {
name: 'PollList',
Expand All @@ -131,6 +135,7 @@ export default {
RestorePollIcon,
PollsAppIcon,
PollItem: () => import('../components/PollList/PollItem.vue'),
RecycleScroller,
},

computed: {
Expand Down Expand Up @@ -270,6 +275,15 @@ export default {
</script>

<style lang="scss">
.poll-list {
.area__main {
flex-grow: 1;
height: 0;
display: flex;
flex-direction: column;
}
}

.poll-list__list {
width: 100%;
display: flex;
Expand Down
Loading