From 0765a2285a0366878c90cfbbf47fa5d70c0e9ea7 Mon Sep 17 00:00:00 2001 From: scottybollinger Date: Thu, 27 Jan 2022 15:07:10 -0600 Subject: [PATCH] [Workplace Search] Fix bug where modal visible after deleting a group This PR fixes a bug in Workplace Search where, after you delete a group, the next group you click into will automatically show the delete modal for that group. --- .../workplace_search/views/groups/group_logic.test.ts | 2 ++ .../applications/workplace_search/views/groups/group_logic.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.test.ts index 3048dcedef26f..df61e23fa3cdc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.test.ts @@ -210,11 +210,13 @@ describe('GroupLogic', () => { describe('deleteGroup', () => { beforeEach(() => { GroupLogic.actions.onInitializeGroup(group); + GroupLogic.actions.showConfirmDeleteModal(); }); it('deletes a group', async () => { http.delete.mockReturnValue(Promise.resolve(true)); GroupLogic.actions.deleteGroup(); + expect(GroupLogic.values.confirmDeleteModalVisible).toEqual(false); expect(http.delete).toHaveBeenCalledWith('/internal/workplace_search/groups/123'); await nextTick(); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.ts index 6e465854ff44f..6b6fa0f21aba2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_logic.ts @@ -122,6 +122,7 @@ export const GroupLogic = kea>({ { showConfirmDeleteModal: () => true, hideConfirmDeleteModal: () => false, + deleteGroup: () => false, }, ], groupNameInputValue: [