From dfc1651327af161bfa9c66cb71e2678550b4f9ff Mon Sep 17 00:00:00 2001 From: Diego Imbert Date: Tue, 12 May 2026 17:18:10 +0200 Subject: [PATCH] feat(frontend): wire AzureTrigger editor to UserDraft Same pattern as the other triggers. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../azure/AzureTriggerEditorInner.svelte | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/frontend/src/lib/components/triggers/azure/AzureTriggerEditorInner.svelte b/frontend/src/lib/components/triggers/azure/AzureTriggerEditorInner.svelte index de8ac92ee1..627acb3781 100644 --- a/frontend/src/lib/components/triggers/azure/AzureTriggerEditorInner.svelte +++ b/frontend/src/lib/components/triggers/azure/AzureTriggerEditorInner.svelte @@ -25,6 +25,7 @@ import { saveAzureTriggerFromCfg } from './utils' import { getHandlerType, handleConfigChange, type Trigger } from '../utils' import { deepEqual } from 'fast-equals' + import { UserDraft } from '$lib/userDraft.svelte' import TriggerSuspendedJobsAlert from '../TriggerSuspendedJobsAlert.svelte' import TriggerSuspendedJobsModal from '../TriggerSuspendedJobsModal.svelte' import { base } from '$lib/base' @@ -124,14 +125,18 @@ edit = true dirtyPath = false await loadTrigger(defaultValues) + if (!defaultValues) { + initialConfig = structuredClone($state.snapshot(getAzureConfig())) + } originalConfig = structuredClone($state.snapshot(getAzureConfig())) + const localCfg = UserDraft.get>('schedule_azure', ePath) + if (localCfg && !deepEqual(localCfg, getAzureConfig())) { + await loadTriggerConfig(localCfg) + } } catch (err) { sendUserToast(`Could not load Azure trigger: ${err.body}`, true) } finally { drawerLoading = false - if (!defaultValues) { - initialConfig = structuredClone($state.snapshot(getAzureConfig())) - } } } @@ -210,6 +215,7 @@ async function updateTrigger(): Promise { deploymentLoading = true + const previousPath = initialPath const cfg = azureConfig if (!cfg) return const isSaved = await saveAzureTriggerFromCfg( @@ -220,6 +226,7 @@ usedTriggerKinds ) if (isSaved) { + UserDraft.remove('schedule_azure', previousPath) onUpdate?.(cfg.path) originalConfig = structuredClone($state.snapshot(getAzureConfig())) initialPath = cfg.path @@ -296,6 +303,11 @@ const args = [captureConfig, isValid] as const untrack(() => onCaptureConfigChange?.(...args)) }) + + $effect(() => { + if (drawerLoading || !initialPath) return + azureConfig && UserDraft.save('schedule_azure', initialPath, azureConfig) + }) {#if mode === 'suspended'}