fix(ui): deduplicate layout-level API requests (#25942)

This commit is contained in:
G30
2026-06-16 18:09:50 -04:00
committed by GitHub
parent ee3a49a88d
commit 966b3fdb57
4 changed files with 7 additions and 23 deletions
@@ -29,10 +29,10 @@
export let saveHandler: Function;
let updateAvailable = null;
let updateAvailable = false;
let version = {
current: '',
latest: ''
current: WEBUI_VERSION,
latest: WEBUI_VERSION
};
let adminConfig = null;
@@ -106,10 +106,6 @@
};
onMount(async () => {
if ($config?.features?.enable_version_update_check) {
checkForVersionUpdates();
}
await Promise.all([
(async () => {
adminConfig = await getAdminConfig(localStorage.token);
@@ -129,7 +125,7 @@
const ldapConfig = await getLdapConfig(localStorage.token);
ENABLE_LDAP = ldapConfig.ENABLE_LDAP;
banners = await getBanners(localStorage.token);
banners = [...$_banners];
});
</script>
+3
View File
@@ -14,6 +14,7 @@
import { getBanners } from '$lib/apis/configs';
import { getTerminalServers } from '$lib/apis/terminal';
import { getUserSettings } from '$lib/apis/users';
import { setTextScale } from '$lib/utils/text-scale';
import { WEBUI_VERSION, WEBUI_API_BASE_URL } from '$lib/constants';
import { compareVersion } from '$lib/utils';
@@ -105,6 +106,8 @@
settings.set(userSettings.ui);
}
setTextScale($settings?.textScale ?? 1);
if (cb) {
await cb();
}
@@ -1,11 +1,8 @@
<script>
import { goto } from '$app/navigation';
import { onMount } from 'svelte';
import Settings from '$lib/components/admin/Settings.svelte';
onMount(() => {
goto('/admin/settings/general');
});
</script>
<Settings />
-12
View File
@@ -993,18 +993,6 @@
$socket?.on('events', chatEventHandler);
$socket?.on('events:channel', channelEventHandler);
const userSettings = await getUserSettings(localStorage.token);
if (userSettings) {
settings.set(userSettings.ui);
} else {
try {
settings.set(JSON.parse(localStorage.getItem('settings') ?? '{}'));
} catch {
settings.set({});
}
}
setTextScale($settings?.textScale ?? 1);
// Set up the token expiry check
if (tokenTimer) {
clearInterval(tokenTimer);