From fd17ab0b8c9be490efa3d065d54c41d7aecff6f1 Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Wed, 21 May 2025 23:57:16 +0800 Subject: [PATCH 1/2] preserve timeline when switching presets --- .../src/routes/editor/PresetsDropdown.tsx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/desktop/src/routes/editor/PresetsDropdown.tsx b/apps/desktop/src/routes/editor/PresetsDropdown.tsx index a779d2df087..75a4e545ddb 100644 --- a/apps/desktop/src/routes/editor/PresetsDropdown.tsx +++ b/apps/desktop/src/routes/editor/PresetsDropdown.tsx @@ -14,7 +14,7 @@ import { } from "./ui"; export function PresetsDropdown() { - const { setDialog, presets, setProject } = useEditorContext(); + const { setDialog, presets, setProject, project } = useEditorContext(); return ( @@ -45,6 +45,16 @@ export function PresetsDropdown() { {(preset, i) => { const [showSettings, setShowSettings] = createSignal(false); + function applyPreset() { + setShowSettings(false); + setProject( + reconcile({ + ...preset.config, + timeline: project.timeline, + }) + ); + } + return ( @@ -52,8 +62,7 @@ export function PresetsDropdown() { class="h-[2.5rem]" onFocusIn={() => setShowSettings(false)} onClick={() => { - setShowSettings(false); - setProject(reconcile(preset.config)); + applyPreset(); }} > {preset.name} @@ -88,8 +97,7 @@ export function PresetsDropdown() { > { - setShowSettings(false); - setProject(reconcile(preset.config)); + applyPreset(); }} > Apply From 64b6f32f304ee104b37f4c1c222cd2c432afadeb Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Wed, 21 May 2025 23:57:30 +0800 Subject: [PATCH 2/2] make preset deserialization a silent failure --- apps/desktop/src-tauri/src/presets.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src-tauri/src/presets.rs b/apps/desktop/src-tauri/src/presets.rs index 3b846e94389..56ba8db4dc7 100644 --- a/apps/desktop/src-tauri/src/presets.rs +++ b/apps/desktop/src-tauri/src/presets.rs @@ -4,6 +4,7 @@ use serde_json::json; use specta::Type; use tauri::{AppHandle, Wry}; use tauri_plugin_store::StoreExt; +use tracing::error; #[derive(Serialize, Deserialize, Type, Debug, Default)] #[serde(rename_all = "camelCase")] @@ -26,7 +27,10 @@ impl PresetsStore { // Handle potential deserialization errors gracefully match serde_json::from_value(store) { Ok(settings) => Ok(Some(settings)), - Err(_) => Err("Failed to deserialize presets store".to_string()), + Err(_) => { + error!("Failed to deserialize presets store"); + Ok(None) + } } } _ => Ok(None),