feat: remove fetching of machine data on settings page load to improve performance

This commit is contained in:
Flavio Fois
2026-02-10 22:49:31 +01:00
parent eac7a12cd4
commit 6f373dd9ab
2 changed files with 4 additions and 10 deletions

View File

@@ -1,25 +1,18 @@
import type { PageLoad } from './$types';
import { GetMachineData, GetConfig } from "$lib/wailsjs/go/main/App";
import { GetConfig } from "$lib/wailsjs/go/main/App";
import { browser } from '$app/environment';
import { dangerZoneEnabled } from "$lib/stores/app";
import { get } from "svelte/store";
export const load = (async () => {
if (!browser) return { machineData: null, config: null };
if (!browser) return { config: null };
try {
const [machineData, configRoot] = await Promise.all([
get(dangerZoneEnabled) ? GetMachineData() : Promise.resolve(null),
GetConfig()
]);
const configRoot = await GetConfig();
return {
machineData,
config: configRoot.EMLy
};
} catch (e) {
console.error("Failed to load settings data", e);
return {
machineData: null,
config: null
};
}