Skip to content

Commit

Permalink
fix: Omit permanent circular ncbi (#512) (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
gromdimon authored Feb 19, 2024
1 parent 49230a2 commit 3836272
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/components/GeneOverviewCard/GeneRifs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,19 @@ watch(() => props.ncbi?.rifEntries, initializeItems)
// Load more items.
type Done = (status: 'error' | 'loading' | 'empty' | 'ok') => void
type LoadItemsArgs = { done: Done }
const loadItems = ({ done }: LoadItemsArgs) => {
const loadItems = async ({ done }: LoadItemsArgs) => {
if (props.ncbi?.rifEntries?.length) {
if (items.value.length === props.ncbi.rifEntries.length) {
done('empty')
} else {
const nextItems = props.ncbi.rifEntries.slice(items.value.length, items.value.length + 10)
items.value = items.value.concat(nextItems)
done('ok')
setTimeout(() => {
const nextItems = (props.ncbi?.rifEntries ?? []).slice(
items.value.length,
items.value.length + 10
)
items.value = items.value.concat(nextItems)
done('ok')
}, 1000)
}
}
}
Expand All @@ -53,7 +58,7 @@ const loadItems = ({ done }: LoadItemsArgs) => {
</div>
</div>
<div v-if="ncbi?.rifEntries?.length" class="d-flex flex-column flex-grow-1">
<v-infinite-scroll :height="200" style="font-size: 90%" :items="items" :on-load="loadItems">
<v-infinite-scroll :height="200" style="font-size: 90%" :items="items" @load="loadItems">
<template v-for="(item, index) in items" :key="index">
<div v-if="item?.text?.length">
{{ item.text }}
Expand Down

0 comments on commit 3836272

Please sign in to comment.