fix: unarchive chats moved into folders and refresh sidebar folders after menu moves (#27485)

This commit is contained in:
G30
2026-07-26 18:43:34 -04:00
committed by GitHub
parent 71f8b6d5b4
commit db92ef292f
4 changed files with 38 additions and 2 deletions
+18
View File
@@ -61,6 +61,24 @@ export const refreshChatList = async (
return { accepted: true, allLoaded };
};
// The sidebar's folders keep their chat lists in local component state, refreshed
// through a registry of per-folder callbacks that only the sidebar can reach.
// Handlers registered here let other components (e.g. the open chat's menu)
// request that refresh without a reference to the sidebar.
type FolderRefreshHandler = () => unknown;
const folderRefreshHandlers = new Set<FolderRefreshHandler>();
export const registerFolderRefreshHandler = (handler: FolderRefreshHandler) => {
folderRefreshHandlers.add(handler);
return () => {
folderRefreshHandlers.delete(handler);
};
};
export const refreshFolderChatLists = async () => {
await Promise.all([...folderRefreshHandlers].map((handler) => handler()));
};
export const loadNextChatListPage = async (token: string = ''): Promise<ChatListResult> => {
if (!paginationReady || allLoaded || loadingNextPage) {
return { accepted: false, allLoaded };