fix(preferences): use Object.assign mutation to prevent infinite effect loops
Replacing the preferences object (spread reassignment) caused all consumers' prefs references to go stale — the loop guard read the old value forever. Svelte 5 shared state pattern requires a stable const object with property mutations, not reassignment. Also removes duplicate theme sync $effect from SettingsPage (already handled in +layout.svelte).
This commit is contained in:
@@ -281,14 +281,6 @@
|
||||
saveSettings();
|
||||
});
|
||||
|
||||
// Sync theme setting to preferences store
|
||||
$effect(() => {
|
||||
const map = { Dark: 'dark', Light: 'light', System: 'system' };
|
||||
const mapped = map[settings.theme] || 'dark';
|
||||
if (prefs.theme !== mapped) {
|
||||
updatePreferences({ theme: mapped });
|
||||
}
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
settings.engine;
|
||||
|
||||
Reference in New Issue
Block a user