fix(css): remove remaining store accesses from $derived() blocks
+layout.svelte: $isLoading inside $derived() -> isReady() function HomeView.svelte: $t() inside $derived.by() -> getGreetingText() function These caused vite-plugin-svelte CSS extraction to fail, cascading PostCSS errors to unrelated components during HMR.
This commit is contained in:
1 parent
ecd006d176
commit
1d284ac82a
2 files changed
+9
-7
No files matched your search
@@ -165,14 +165,14 @@
|
||||
let homeSettings = $state<HomeSettings>(getSettings());
|
||||
let isSettingsModalOpen = $state(false);
|
||||
|
||||
// Computed greeting with i18n support
|
||||
const greetingText = $derived.by(() => {
|
||||
// Computed greeting with i18n support — never call $t() inside $derived()
|
||||
function getGreetingText(): string {
|
||||
const info = getGreetingInfo(userName);
|
||||
if (info.type === 'custom') {
|
||||
return info.text;
|
||||
}
|
||||
return $t(info.key, { values: { name: info.name } });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Check if a section is visible
|
||||
@@ -905,7 +905,7 @@
|
||||
<!-- Header with greeting, filter and settings -->
|
||||
<div class="home-header">
|
||||
{#if homeSettings.greeting.enabled}
|
||||
<h2 class="greeting">{greetingText}</h2>
|
||||
<h2 class="greeting">{getGreetingText()}</h2>
|
||||
{:else}
|
||||
<div></div>
|
||||
{/if}
|
||||
|
||||
Reference in new issue
Block a user