fix: Prevent FOUC and repetitive setting of about info

This commit is contained in:
Ushie
2025-07-03 02:45:00 +03:00
parent 4dfb3a2526
commit ebe9523041
5 changed files with 5 additions and 7 deletions

View File

@@ -21,7 +21,7 @@
%sveltekit.head%
</head>
<body>
<body style="background-color: var(--background-one)">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>

View File

@@ -23,7 +23,6 @@ html {
body {
margin: 0;
padding: 0;
background-color: var(--background-one);
}
html,

View File

@@ -16,8 +16,6 @@ export function api_base_url(): string {
if (browser) {
const apiUrl = localStorage.getItem(URL_KEY) || default_api_url;
set_about_info(apiUrl);
return apiUrl;
}
@@ -46,11 +44,11 @@ export function set_api_base_url(url?: string) {
localStorage.removeItem(URL_KEY);
} else {
localStorage.setItem(URL_KEY, url);
set_about_info(url);
}
set_about_info(api_base_url());
}
function set_about_info(apiUrl: string) {
export function set_about_info(apiUrl: string) {
if (!localStorage.getItem(STATUS_KEY) || !localStorage.getItem(EMAIL_KEY)) {
fetch(`${apiUrl}/v4/about`)
.then((response) => (response.ok ? response.json() : null))

View File

@@ -78,7 +78,6 @@
<style lang="scss">
footer {
background-color: var(--background-one);
max-width: min(87%, 100rem);
padding: 5rem 0rem;
margin: 0 auto;

View File

@@ -24,6 +24,7 @@
import { events as themeEvents } from '$util/themeEvents';
import FooterHost from '$layout/Footer/FooterHost.svelte';
import { api_base_url, set_about_info } from '$data/api/settings';
const queryClient = new QueryClient({
defaultOptions: {
@@ -50,6 +51,7 @@
);
onMount(() => {
set_about_info(api_base_url());
new DateTriggerEventHandler(themeEvents);
isRestoring.set(true);