mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-11 03:38:02 +00:00
refac
This commit is contained in:
parent
94e9c7fef9
commit
9fad17558b
2 changed files with 6 additions and 7 deletions
|
|
@ -28,6 +28,7 @@
|
|||
sidebarWidth
|
||||
} from '$lib/stores';
|
||||
import {
|
||||
allLoaded,
|
||||
loadNextChatListPage,
|
||||
refreshChatList,
|
||||
registerFolderRefreshHandler,
|
||||
|
|
@ -116,7 +117,8 @@
|
|||
// Pagination variables
|
||||
let chatListLoading = false;
|
||||
let chatListReady = false;
|
||||
let allChatsLoaded = false;
|
||||
// Read pagination state when the shared list publishes its rows.
|
||||
$: allChatsLoaded = $chats !== null && allLoaded;
|
||||
|
||||
let showCreateFolderModal = false;
|
||||
|
||||
|
|
@ -379,7 +381,6 @@
|
|||
const initChatList = async () => {
|
||||
// Reset pagination variables
|
||||
console.log('initChatList');
|
||||
allChatsLoaded = false;
|
||||
chatListReady = false;
|
||||
|
||||
await Promise.all([
|
||||
|
|
@ -422,7 +423,6 @@
|
|||
if (result.accepted) {
|
||||
await initFolders();
|
||||
await Promise.all(Object.values(folderRegistry).map((folder) => folder?.setFolderItems?.()));
|
||||
allChatsLoaded = result.allLoaded;
|
||||
chatListReady = true;
|
||||
}
|
||||
};
|
||||
|
|
@ -434,8 +434,7 @@
|
|||
|
||||
chatListLoading = true;
|
||||
|
||||
const result = await loadNextChatListPage(localStorage.token);
|
||||
allChatsLoaded = result.allLoaded;
|
||||
await loadNextChatListPage(localStorage.token);
|
||||
|
||||
chatListLoading = false;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export const pinnedChats = readonly(pinnedChatsStore);
|
|||
let currentPage = 1;
|
||||
let paginationReady = false;
|
||||
let requestGeneration = 0;
|
||||
let allLoaded = false;
|
||||
export let allLoaded = false;
|
||||
let loadingNextPage = false;
|
||||
|
||||
type RefreshChatListOptions = {
|
||||
|
|
@ -47,9 +47,9 @@ export const refreshChatList = async (
|
|||
return { accepted: false, allLoaded };
|
||||
}
|
||||
|
||||
chatsStore.set(nextChats);
|
||||
currentPage = 1;
|
||||
allLoaded = nextChats.length === 0;
|
||||
chatsStore.set(nextChats);
|
||||
|
||||
if (options.clearPinned) {
|
||||
pinnedChatsStore.set([]);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue