diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/index.ts b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/index.ts index a109640f09bbe..6c232dbb8c588 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/index.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/index.ts @@ -12,4 +12,5 @@ export { setErrorMessage, setQueuedSuccessMessage, setQueuedErrorMessage, + clearFlashMessages, } from './set_message_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/set_message_helpers.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/set_message_helpers.test.ts index c5ee8200c490d..4a5a4bb6be1f3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/set_message_helpers.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/set_message_helpers.test.ts @@ -16,6 +16,7 @@ import { setErrorMessage, setQueuedSuccessMessage, setQueuedErrorMessage, + clearFlashMessages, } from './'; describe('Flash Message Helpers', () => { @@ -68,4 +69,10 @@ describe('Flash Message Helpers', () => { }, ]); }); + + it('clearFlashMessages()', () => { + clearFlashMessages(); + + expect(FlashMessagesLogic.values.messages).toEqual([]); + }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/set_message_helpers.ts b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/set_message_helpers.ts index cb73d54fd7b1e..e054ff6e2fd5a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/set_message_helpers.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/set_message_helpers.ts @@ -33,3 +33,7 @@ export const setQueuedErrorMessage = (message: string) => { message, }); }; + +export const clearFlashMessages = () => { + FlashMessagesLogic.actions.clearFlashMessages(); +};