From 01fdd51b5a5d6be0b3f4fa838788400617487934 Mon Sep 17 00:00:00 2001 From: Patrick Niebeling Date: Thu, 13 Aug 2026 14:51:28 +0200 Subject: [PATCH] Keep the stored stacks and filters when editing a workflow editWorkflow() filled the form and then called onBoardChange() to populate the dependent dropdowns -- but that function exists to *reset* them, so it immediately nulled sourceStackId, targetStackId and both filter lists again. The board stayed selected because it is not one of the fields it clears. Split the two responsibilities: loadBoardOptions() only fetches the stack/label/user lists, onBoardChange() clears the dependent selection and then delegates to it. Editing now calls loadBoardOptions() directly. onBoardChange() additionally ignores re-picking the board that is already loaded, so selecting the same entry again no longer wipes the form. --- src/PersonalSettings.vue | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/src/PersonalSettings.vue b/src/PersonalSettings.vue index 208440e..721117a 100644 --- a/src/PersonalSettings.vue +++ b/src/PersonalSettings.vue @@ -164,6 +164,8 @@ const editingId = ref(null) const stackOptions = ref([]) const labelOptions = ref([]) const participantOptions = ref([]) +// Which board the three lists above currently belong to. +const loadedBoardId = ref(null) const boardOptions = computed(() => boards.value.map((board) => ({ value: board.id, label: board.title }))) @@ -223,14 +225,16 @@ async function loadAll() { } } -async function onBoardChange(boardId) { - form.sourceStackId = null - form.targetStackId = null - form.filterUserIds = [] - form.filterLabelIds = [] +/** + * Fills the stack/label/user dropdowns for a board without touching the + * current selection — that separation matters: editing a workflow has to + * load the same options but must keep the stored stacks and filters. + */ +async function loadBoardOptions(boardId) { stackOptions.value = [] labelOptions.value = [] participantOptions.value = [] + loadedBoardId.value = boardId ?? null if (!boardId) { return @@ -249,13 +253,29 @@ async function onBoardChange(boardId) { participantOptions.value = participants.map((participant) => ({ value: participant.uid, label: participant.displayName })) } +/** + * Only for the board dropdown: a *different* board invalidates everything + * that referenced the old one. Re-picking the same board is a no-op, so it + * doesn't silently wipe the form. + */ +async function onBoardChange(boardId) { + if (boardId === loadedBoardId.value) { + return + } + + form.sourceStackId = null + form.targetStackId = null + form.filterUserIds = [] + form.filterLabelIds = [] + + await loadBoardOptions(boardId) +} + function startCreate() { Object.assign(form, emptyForm()) editingId.value = null formError.value = '' - stackOptions.value = [] - labelOptions.value = [] - participantOptions.value = [] + loadBoardOptions(null) showForm.value = true } @@ -273,7 +293,7 @@ async function editWorkflow(workflow) { editingId.value = workflow.id formError.value = '' showForm.value = true - await onBoardChange(workflow.boardId) + await loadBoardOptions(workflow.boardId) } function cancelForm() {