From d1ad0e1f89130de56585f4c328aa2beaa25dec44 Mon Sep 17 00:00:00 2001 From: "bert.hausmans" Date: Fri, 10 Apr 2026 20:37:38 +0200 Subject: [PATCH] fix: refresh assignable persons list after assignment and keep dialog open Invalidate assignable-persons query cache in useAssignPersonToShift onSuccess so the list reflects the new assignment immediately. Keep the dialog open after assigning a person to allow sequential assignments, showing a brief success snackbar instead of closing. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../src/components/shifts/AssignPersonDialog.vue | 13 ++++++++++++- apps/app/src/composables/api/useShiftAssignments.ts | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/app/src/components/shifts/AssignPersonDialog.vue b/apps/app/src/components/shifts/AssignPersonDialog.vue index aaad2480..6c30b5a4 100644 --- a/apps/app/src/components/shifts/AssignPersonDialog.vue +++ b/apps/app/src/components/shifts/AssignPersonDialog.vue @@ -26,6 +26,8 @@ const searchQuery = ref('') const showOnlyAvailable = ref(true) const selectedCrowdType = ref(null) const assignError = ref(null) +const showSuccess = ref(false) +const successName = ref('') // Clear error on filter changes watch([searchQuery, showOnlyAvailable, selectedCrowdType], () => { @@ -111,7 +113,8 @@ async function handleAssign(person: AssignablePerson) { personId: person.id, }) emit('assigned') - modelValue.value = false + successName.value = person.name + showSuccess.value = true } catch (error: any) { const message = error.response?.data?.errors?.person_id?.[0] @@ -348,4 +351,12 @@ async function handleAssign(person: AssignablePerson) { + + + {{ successName }} toegewezen + diff --git a/apps/app/src/composables/api/useShiftAssignments.ts b/apps/app/src/composables/api/useShiftAssignments.ts index 15ca41a2..41c688e8 100644 --- a/apps/app/src/composables/api/useShiftAssignments.ts +++ b/apps/app/src/composables/api/useShiftAssignments.ts @@ -140,6 +140,7 @@ export function useAssignPersonToShift(eventId: Ref) { }, onSuccess: () => { queryClient.invalidateQueries({ queryKey: ['shift-assignments', eventId.value] }) + queryClient.invalidateQueries({ queryKey: ['assignable-persons'] }) queryClient.invalidateQueries({ queryKey: ['shifts'] }) queryClient.invalidateQueries({ queryKey: ['persons', eventId.value] }) },