From ce5372f12a248646b2efa6e9b1e92a3dc96ce735 Mon Sep 17 00:00:00 2001 From: Jay George Date: Mon, 19 Oct 2026 14:38:05 +0100 Subject: [PATCH] Refetch bulk actions when the selections array is replaced BulkActions watched the array it was first given, so once a listing replaced its selections (e.g. via an action's replaceInSelections callback), selecting other items no longer fetched their actions and the toolbar kept showing stale ones. --- resources/js/components/actions/BulkActions.vue | 2 +- resources/js/tests/components/Listing.test.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/js/components/actions/BulkActions.vue b/resources/js/components/actions/BulkActions.vue index 9a9252afb5c..f5cb1e8582d 100644 --- a/resources/js/components/actions/BulkActions.vue +++ b/resources/js/components/actions/BulkActions.vue @@ -42,7 +42,7 @@ let hasSelections = computed(() => { return props.selections.length > 0; }); -watch(props.selections, getActions, { deep: true }); +watch(() => props.selections, getActions, { deep: true }); function getActions() { if (!hasSelections.value) { diff --git a/resources/js/tests/components/Listing.test.js b/resources/js/tests/components/Listing.test.js index 07424ec1f6d..0176fcdda57 100644 --- a/resources/js/tests/components/Listing.test.js +++ b/resources/js/tests/components/Listing.test.js @@ -11,6 +11,8 @@ import { setTranslations } from '@/translations/translator'; vi.mock('axios', () => ({ default: { get: vi.fn(), + // BulkActions fetches the available actions whenever the selections change. + post: vi.fn(() => Promise.resolve({ data: [] })), isCancel: vi.fn(() => false), }, }));