feature (loadspeed): shave a couple ms from load time

This commit is contained in:
MickaelK 2025-08-19 01:00:48 +10:00
parent aea5150e43
commit a18d17490c
3 changed files with 5 additions and 3 deletions

View file

@ -4,6 +4,7 @@ import { init as setup_translation } from "../locales/index.js";
import { init as setup_config } from "../model/config.js";
import { init as setup_plugin } from "../model/plugin.js";
import { init as setup_chromecast } from "../model/chromecast.js";
import { init as setup_cache } from "../pages/filespage/cache.js";
import { report } from "../helpers/log.js";
import { $error } from "./common.js";
@ -22,6 +23,7 @@ export default async function main() {
setup_history(),
setup_polyfill(),
setup_plugin(),
setup_cache(),
]);
window.dispatchEvent(new window.Event("pagechange"));
} catch (err) {

View file

@ -8,7 +8,6 @@ import componentFilesystem, { init as initFilesystem } from "./filespage/ctrl_fi
import componentSubmenu, { init as initSubmenu } from "./filespage/ctrl_submenu.js";
import componentNewItem, { init as initNewItem } from "./filespage/ctrl_newitem.js";
import componentUpload, { init as initUpload } from "./filespage/ctrl_upload.js";
import { init as initCache } from "./filespage/cache.js";
import { init as initState } from "./filespage/state_config.js";
import { init as initThing } from "./filespage/thing.js";
@ -46,7 +45,7 @@ export default WithShell(function(render) {
export function init() {
return Promise.all([
loadCSS(import.meta.url, "ctrl_filespage.css"),
initShell(), initFilesystem(), initCache(),
initShell(), initFilesystem(),
initSubmenu(), initNewItem(), initUpload(),
initState(), initThing(),
]);

View file

@ -1,5 +1,6 @@
import assert from "../../lib/assert.js";
import { getSession } from "../../model/session.js";
import { onLogout } from "../ctrl_logout.js";
class ICache {
/**
@ -238,10 +239,10 @@ export async function init() {
try {
const session = await getSession().toPromise();
backendID = session.backendID;
onLogout(() => backendID = "");
} catch (err) {}
}
};
return Promise.all([setup_cache(), setup_session()]);
}