From ecd006d17695f7bd03c687dc9dd0a66489dc9aea Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Sat, 7 Feb 2026 12:13:24 -0600 Subject: [PATCH] fix(css): remove $t() from $derived() to fix PostCSS extraction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ImmersiveHeader splitTabs used $t() inside $derived(), causing vite-plugin-svelte CSS extraction to receive raw script content instead of CSS — cascading PostCSS errors to unrelated components. ShortcutInput had the same pattern for displayShortcut. Both now use the labelKey/function pattern instead. --- src/lib/components/ShortcutInput.svelte | 15 +++++++++------ .../components/immersive/ImmersiveHeader.svelte | 11 ++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/lib/components/ShortcutInput.svelte b/src/lib/components/ShortcutInput.svelte index d5a95f9ad..3bb98d169 100644 --- a/src/lib/components/ShortcutInput.svelte +++ b/src/lib/components/ShortcutInput.svelte @@ -30,11 +30,14 @@ let inputElement: HTMLButtonElement | null = $state(null); const isModified = $derived(currentShortcut !== defaultShortcut); - const displayShortcut = $derived( - isRecording - ? (recordedShortcut || $t('keybindings.pressKeys') || 'Press keys...') - : formatShortcutDisplay(currentShortcut) - ); + + // Never call $t() inside $derived() — use a function instead + function getDisplayShortcut(): string { + if (isRecording) { + return recordedShortcut || $t('keybindings.pressKeys') || 'Press keys...'; + } + return formatShortcutDisplay(currentShortcut); + } function startRecording() { isRecording = true; @@ -121,7 +124,7 @@ onkeydown={handleKeydown} onblur={handleBlur} > - {displayShortcut} + {getDisplayShortcut()} {#if isModified && !isRecording} * {/if} diff --git a/src/lib/components/immersive/ImmersiveHeader.svelte b/src/lib/components/immersive/ImmersiveHeader.svelte index 932e1d9b3..5351cf983 100644 --- a/src/lib/components/immersive/ImmersiveHeader.svelte +++ b/src/lib/components/immersive/ImmersiveHeader.svelte @@ -75,11 +75,12 @@ } // Split mode tabs + // Use labelKey pattern — never call $t() inside $derived() const splitTabs = $derived([ - { id: 'lyrics' as const, label: $t('player.lyrics'), icon: Music2, enabled: hasLyrics }, - { id: 'trackInfo' as const, label: $t('player.trackInfo') || 'Track Info', icon: Info, enabled: hasTrackInfo }, - { id: 'suggestions' as const, label: $t('player.suggestions') || 'Suggestions', icon: Radio, enabled: hasSuggestions }, - { id: 'queue' as const, label: $t('player.queue') || 'Queue', icon: ListMusic, enabled: true }, + { id: 'lyrics' as const, labelKey: 'player.lyrics', icon: Music2, enabled: hasLyrics }, + { id: 'trackInfo' as const, labelKey: 'player.trackInfo', icon: Info, enabled: hasTrackInfo }, + { id: 'suggestions' as const, labelKey: 'player.suggestions', icon: Radio, enabled: hasSuggestions }, + { id: 'queue' as const, labelKey: 'player.queue', icon: ListMusic, enabled: true }, ].filter(tab => tab.enabled)); // Focus mode tabs @@ -134,7 +135,7 @@ onclick={() => onTabChange(tab.id)} > - {tab.label} + {$t(tab.labelKey)} {/each} {/if}