diff --git a/resources/js/components/actions/BulkActions.vue b/resources/js/components/actions/BulkActions.vue index 5382b1eb4a0..1661506a37d 100644 --- a/resources/js/components/actions/BulkActions.vue +++ b/resources/js/components/actions/BulkActions.vue @@ -16,6 +16,7 @@ const emit = defineEmits(['started', 'completed']); const { prepareActions, runServerAction } = useActions(); let actions = ref([]); +let actionsReady = ref(false); const confirmableActions = useTemplateRef('confirmableActions'); @@ -46,9 +47,12 @@ watch(props.selections, getActions, { deep: true }); function getActions() { if (!hasSelections.value) { actions.value = []; + actionsReady.value = false; return; } + actionsReady.value = false; + let params = { selections: toRaw(props.selections), }; @@ -59,7 +63,10 @@ function getActions() { axios .post(props.url + '/list', params) - .then(response => actions.value = response.data); + .then(response => { + actions.value = response.data; + actionsReady.value = true; + }); } let errors = ref({}); @@ -91,5 +98,6 @@ function runAction(action, values, onSuccess, onError) { diff --git a/resources/js/components/ui/Listing/BulkActions.vue b/resources/js/components/ui/Listing/BulkActions.vue index 63ef6e7f578..f2b92c9e430 100644 --- a/resources/js/components/ui/Listing/BulkActions.vue +++ b/resources/js/components/ui/Listing/BulkActions.vue @@ -40,10 +40,10 @@ function actionFailed(response) { :context="actionContext" @started="actionStarted" @completed="actionCompleted" - v-slot="{ actions }" + v-slot="{ actions, actionsReady }" >