mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
@@ -100,12 +100,16 @@ export function useItems(collection: Ref<string>, query: Query) {
|
||||
}
|
||||
});
|
||||
|
||||
let loadingTimeout: number | null = null;
|
||||
|
||||
return { itemCount, totalCount, items, totalPages, loading, error, changeManualSort, getItems };
|
||||
|
||||
async function getItems() {
|
||||
if (loadingTimeout) return;
|
||||
|
||||
error.value = null;
|
||||
|
||||
const loadingTimeout = setTimeout(() => {
|
||||
loadingTimeout = setTimeout(() => {
|
||||
loading.value = true;
|
||||
}, 250);
|
||||
|
||||
@@ -182,6 +186,7 @@ export function useItems(collection: Ref<string>, query: Query) {
|
||||
error.value = err;
|
||||
} finally {
|
||||
clearTimeout(loadingTimeout);
|
||||
loadingTimeout = null;
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user