fix(ui): remove flicker-causing effect and add view transition to Settings

- Remove problematic $effect that ran loadPlaybackPreferences() on every
  render, causing a state update loop and visual flicker
- The function is already called in onMount, so the duplicate was redundant
- Add ViewTransition wrapper for consistent subtle animation (200ms fade+slide)
This commit is contained in:
vicrodh committed 2026-01-29 19:09:01 -06:00
1 parent 65ffabbf1d
commit 8db47aaee0
1 file changed
+3 -8
+3 -8
View File
@@ -1,6 +1,7 @@
<script lang="ts">
import { onMount } from 'svelte';
import { invoke } from '@tauri-apps/api/core';
import ViewTransition from '../ViewTransition.svelte';
import { getCurrentWebview } from '@tauri-apps/api/webview';
import { writeText as copyToClipboard } from '@tauri-apps/plugin-clipboard-manager';
import { ArrowLeft, ChevronRight, Loader2 } from 'lucide-svelte';
@@ -679,14 +680,6 @@
};
});
// Reload playback preferences each time the view becomes visible
// This ensures settings are fresh when navigating back to settings
$effect(() => {
// This effect runs whenever the component is rendered
// We reload preferences to ensure they're in sync with backend
console.log('[Settings] Component rendered, reloading playback preferences');
loadPlaybackPreferences();
});
async function loadLastfmState() {
try {
@@ -1789,6 +1782,7 @@
}
</script>
<ViewTransition duration={200} distance={12} direction="up">
<div class="settings-view" bind:this={settingsViewEl}>
<!-- Loading Overlay for Device Enumeration -->
{#if isLoadingDevices}
@@ -2659,6 +2653,7 @@ flatpak override --user --filesystem=/home/USUARIO/Música com.blitzfc.qbz</pre>
</section>
{/if}
</div>
</ViewTransition>
{#if isCheckingNetwork}
<div class="network-check-overlay" aria-busy="true" aria-label={$t('offline.checkingNetwork')}>