From 3a48c0ddf3327c8d59a66c6d02ca1ada52326875 Mon Sep 17 00:00:00 2001 From: Afonso Jorge Ramos Date: Thu, 1 Oct 2026 22:33:15 +0200 Subject: [PATCH 1/2] perf(spicetify-splash): record the theme snapshot when the client is idle --- modules/spicetify-splash/metadata.json | 2 +- modules/spicetify-splash/splash.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/spicetify-splash/metadata.json b/modules/spicetify-splash/metadata.json index ae79ef7..5843efe 100644 --- a/modules/spicetify-splash/metadata.json +++ b/modules/spicetify-splash/metadata.json @@ -1,7 +1,7 @@ { "name": "spicetify-splash", "kind": "extension", - "version": "0.1.0", + "version": "0.1.1", "authors": ["spicetify"], "description": "A splash screen while Spotify, your modules, and your theme start up.", "preview": "https://raw.githubusercontent.com/spicetify/modules/main/previews/spicetify-splash.png", diff --git a/modules/spicetify-splash/splash.ts b/modules/spicetify-splash/splash.ts index 4188f31..c972748 100644 --- a/modules/spicetify-splash/splash.ts +++ b/modules/spicetify-splash/splash.ts @@ -86,7 +86,7 @@ export function showSplash(options: SplashOptions = {}) { custom.remove(); if (recordTheme) { recordTheme = false; - saveThemeSnapshot(CSS, customCss); + whenIdle(() => saveThemeSnapshot(CSS, customCss)); } } @@ -127,6 +127,13 @@ export function showSplash(options: SplashOptions = {}) { }; } +// Reading computed styles right after the splash leaves forces a full style +// recalculation while the client is still settling. +function whenIdle(fn: () => void) { + if ("requestIdleCallback" in window) window.requestIdleCallback(fn, { timeout: 5000 }); + else setTimeout(fn, 0); +} + // Theme sheets are adopted, and adopted sheets cascade after every