Skip to content

Commit ebe9523

Browse files
committed
fix: Prevent FOUC and repetitive setting of about info
1 parent 4dfb3a2 commit ebe9523

File tree

5 files changed

+5
-7
lines changed

5 files changed

+5
-7
lines changed

src/app.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
%sveltekit.head%
2222
</head>
2323

24-
<body>
24+
<body style="background-color: var(--background-one)">
2525
<div style="display: contents">%sveltekit.body%</div>
2626
</body>
2727
</html>

src/app.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ html {
2323
body {
2424
margin: 0;
2525
padding: 0;
26-
background-color: var(--background-one);
2726
}
2827

2928
html,

src/data/api/settings.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ export function api_base_url(): string {
1616
if (browser) {
1717
const apiUrl = localStorage.getItem(URL_KEY) || default_api_url;
1818

19-
set_about_info(apiUrl);
20-
2119
return apiUrl;
2220
}
2321

@@ -46,11 +44,11 @@ export function set_api_base_url(url?: string) {
4644
localStorage.removeItem(URL_KEY);
4745
} else {
4846
localStorage.setItem(URL_KEY, url);
49-
set_about_info(url);
5047
}
48+
set_about_info(api_base_url());
5149
}
5250

53-
function set_about_info(apiUrl: string) {
51+
export function set_about_info(apiUrl: string) {
5452
if (!localStorage.getItem(STATUS_KEY) || !localStorage.getItem(EMAIL_KEY)) {
5553
fetch(`${apiUrl}/v4/about`)
5654
.then((response) => (response.ok ? response.json() : null))

src/layout/Footer/FooterHost.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878

7979
<style lang="scss">
8080
footer {
81-
background-color: var(--background-one);
8281
max-width: min(87%, 100rem);
8382
padding: 5rem 0rem;
8483
margin: 0 auto;

src/routes/+layout.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import { events as themeEvents } from '$util/themeEvents';
2525
2626
import FooterHost from '$layout/Footer/FooterHost.svelte';
27+
import { api_base_url, set_about_info } from '$data/api/settings';
2728
2829
const queryClient = new QueryClient({
2930
defaultOptions: {
@@ -50,6 +51,7 @@
5051
);
5152
5253
onMount(() => {
54+
set_about_info(api_base_url());
5355
new DateTriggerEventHandler(themeEvents);
5456
5557
isRestoring.set(true);

0 commit comments

Comments
 (0)