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) <noreply@anthropic.com>
This commit is contained in:
2026-04-10 20:37:38 +02:00
parent 968e17c6d6
commit d1ad0e1f89
2 changed files with 13 additions and 1 deletions

View File

@@ -26,6 +26,8 @@ const searchQuery = ref('')
const showOnlyAvailable = ref(true)
const selectedCrowdType = ref<string | null>(null)
const assignError = ref<string | null>(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) {
</VCardActions>
</VCard>
</VDialog>
<VSnackbar
v-model="showSuccess"
color="success"
:timeout="2000"
>
{{ successName }} toegewezen
</VSnackbar>
</template>

View File

@@ -140,6 +140,7 @@ export function useAssignPersonToShift(eventId: Ref<string>) {
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['shift-assignments', eventId.value] })
queryClient.invalidateQueries({ queryKey: ['assignable-persons'] })
queryClient.invalidateQueries({ queryKey: ['shifts'] })
queryClient.invalidateQueries({ queryKey: ['persons', eventId.value] })
},