fix(ui): deduplicate store fetches with null-guards and mutex (#25943)

This commit is contained in:
G30 authored and GitHub committed 2026-06-17 00:07:11 +02:00
1 parent 22f2fe1ffb
commit ee3a49a88d
6 files changed
+19 -20

No files matched your search

@@ -150,7 +150,8 @@
selectedTab = 'overview';
chatList = [];
allChatsLoaded = false;
selectRange(selectedRange);
selectedRange = '30d';
loadOverview(30);
}
</script>
@@ -51,7 +51,8 @@
// Load history when model changes and modal is shown
$: if (show && model?.id) {
selectRange(selectedRange);
selectedRange = '30d';
loadHistory(30);
}
// Use top_tags from backend response (already computed)
@@ -117,10 +117,6 @@
.map((c) => ({ type: 'channel', id: c.id, label: c.name, data: c }))
];
} else {
if (userSuggestions) {
getUserList();
}
if (modelSuggestions) {
_models = [
...$models
+11 -9
View File
@@ -113,7 +113,6 @@
import Tooltip from '../common/Tooltip.svelte';
import Sidebar from '../icons/Sidebar.svelte';
import Image from '../common/Image.svelte';
import { getBanners } from '$lib/apis/configs';
export let chatIdProp = '';
@@ -330,7 +329,12 @@
);
};
let settingDefaults = false;
const setDefaults = async () => {
if (settingDefaults) return;
settingDefaults = true;
try {
if (!$tools) {
tools.set(await getTools(localStorage.token));
}
@@ -350,7 +354,9 @@
if (model?.info?.meta?.toolIds) {
const defaultIds = [
...new Set(
[...(model?.info?.meta?.toolIds ?? [])].filter((id) => $tools.find((t) => t.id === id))
[...(model?.info?.meta?.toolIds ?? [])].filter((id) =>
$tools.find((t) => t.id === id)
)
)
];
@@ -432,6 +438,9 @@
}
}
}
} finally {
settingDefaults = false;
}
};
const showMessage = async (message, scroll = true) => {
@@ -796,13 +805,6 @@
if (p.url.pathname === '/') {
await tick();
initNewChat();
// Re-fetch banners on navigation to homepage so newly configured banners appear
try {
banners.set(await getBanners(localStorage.token).catch(() => []));
} catch (e) {
console.error('Failed to refresh banners:', e);
}
}
stopAudio();
@@ -58,8 +58,6 @@
import { deleteFileById } from '$lib/apis/files';
import { getChatById } from '$lib/apis/chats';
import { getSessionUser } from '$lib/apis/auths';
import { getTools } from '$lib/apis/tools';
import { getSkills } from '$lib/apis/skills';
import { WEBUI_BASE_URL, WEBUI_API_BASE_URL, PASTED_TEXT_CHARACTER_LIMIT } from '$lib/constants';
import { getOAuthClientAuthorizationUrl } from '$lib/apis/configs';
@@ -1106,9 +1104,6 @@
dropzoneElement.addEventListener('drop', onDrop, true);
dropzoneElement.addEventListener('dragleave', onDragLeave);
}
tools.set(await getTools(localStorage.token));
skills.set(await getSkills(localStorage.token));
};
initialize();
@@ -248,9 +248,13 @@
};
onMount(async () => {
if (!$tools) {
await tools.set(await getTools(localStorage.token));
}
skillsList = (await getSkills(localStorage.token).catch(() => null)) ?? [];
if (!$functions) {
await functions.set(await getFunctions(localStorage.token));
}
// Fetch admin-configured default model metadata so the editor
// reflects the actual defaults rather than hardcoded values