TAKAHASHI Shuuji 2025-09-30 09:38:36 +03:00 zatwierdzone przez GitHub
commit f5feea8cee
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
3 zmienionych plików z 28 dodań i 2 usunięć

Wyświetl plik

@ -45,7 +45,15 @@ defineSlots<{
const { t } = useI18n()
const nuxtApp = useNuxtApp()
const { items, prevItems, update, state, endAnchor, error } = usePaginator(paginator, toRef(() => stream), eventType, preprocess)
const {
items,
prevItems,
update,
state,
endAnchor,
error,
canLoadMore,
} = usePaginator(paginator, toRef(() => stream), eventType, preprocess)
nuxtApp.hook('elk-logo:click', () => {
update()
@ -117,5 +125,18 @@ defineExpose({ createEntry, removeEntry, updateEntry })
<div v-else-if="state === 'error'" p5 text-secondary>
{{ t('common.error') }}: {{ error }}
</div>
<!-- TODO: debug -->
<div flex="~ center col">
<button
flex btn-solid mt-1
:title="$t('settings.notifications.push_notifications.warning.enable_close')"
@click="canLoadMore = true"
>
Load more
</button>
<p m-y-4>
debug: canLoadMore="{{ canLoadMore }}" / state="{{ state }}"
</p>
</div>
</div>
</template>

Wyświetl plik

@ -18,6 +18,7 @@ export function usePaginator<T, P, U = T>(
const items = ref<U[]>([])
const nextItems = ref<U[]>([])
const prevItems = ref<T[]>([])
const canLoadMore = ref<boolean>(true)
const endAnchor = ref<HTMLDivElement>()
const bound = useElementBounding(endAnchor)
@ -70,7 +71,7 @@ export function usePaginator<T, P, U = T>(
}, { immediate: true })
async function loadNext() {
if (state.value !== 'idle')
if (state.value !== 'idle' || !canLoadMore.value)
return
state.value = 'loading'
@ -99,6 +100,7 @@ export function usePaginator<T, P, U = T>(
error.value = e
state.value = 'error'
}
canLoadMore.value = false
await nextTick()
bound.update()
@ -123,6 +125,7 @@ export function usePaginator<T, P, U = T>(
&& state.value === 'idle'
// No new content is loaded when the keepAlive page enters the background
&& deactivated.value === false
&& canLoadMore.value
) {
loadNext()
}
@ -137,5 +140,6 @@ export function usePaginator<T, P, U = T>(
state,
error,
endAnchor,
canLoadMore,
}
}

Wyświetl plik

@ -720,6 +720,7 @@
"year_past": "0 years ago|last year|{n} years ago"
},
"timeline": {
"load_more": "Load more posts",
"no_posts": "No posts here!",
"show_new_items": "Show {v} new items|Show {v} new item|Show {v} new items",
"view_older_posts": "Older posts from other instances may not be displayed."