From 75f1e39ac24496f7ebbfed56eb63b131a54f872e Mon Sep 17 00:00:00 2001 From: Scotty Bollinger Date: Thu, 27 Jan 2022 17:20:07 -0600 Subject: [PATCH] [Workplace Search] Fix bug where modal visible after deleting a group (#123976) 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: [