diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/app_search_gate/app_search_gate.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/app_search_gate/app_search_gate.tsx index cb964f8b48521..4069597ac61fe 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/app_search_gate/app_search_gate.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/app_search_gate/app_search_gate.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React from 'react'; +import React, { useCallback } from 'react'; import { useActions, useValues } from 'kea'; @@ -450,10 +450,14 @@ export const AppSearchGate: React.FC = () => { const { feature, participateInUXLabs } = useValues(AppSearchGateLogic); const { formSubmitRequest, setAdditionalFeedback, setParticipateInUXLabs, setFeature } = useActions(AppSearchGateLogic); + const onSubmitForm = useCallback((e: React.FormEvent) => { + e.preventDefault(); + formSubmitRequest(); + }, []); const options = getOptionsFeaturesList(); return ( - + {i18n.translate('xpack.enterpriseSearch.appSearch.gateForm.features.Label', { defaultMessage: 'What App Search feature are you looking to use?', @@ -598,12 +602,7 @@ export const AppSearchGate: React.FC = () => { - formSubmitRequest()} - > + {i18n.translate('xpack.enterpriseSearch.appSearch.gateForm.submit', { defaultMessage: 'Submit', })} diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/app_search_gate/app_search_gate_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/app_search_gate/app_search_gate_logic.ts index 0cce74ef59de1..a0ee020c0318a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/app_search_gate/app_search_gate_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/app_search_gate/app_search_gate_logic.ts @@ -39,7 +39,10 @@ export const AppSearchGateLogic = kea ({ participateInUXLabs }), }, connect: { - actions: [UpdateAppSearchGatedFormDataApiLogic, ['makeRequest as submitGatedFormDataRequest']], + actions: [ + UpdateAppSearchGatedFormDataApiLogic, + ['makeRequest as submitGatedFormDataRequest', 'apiSuccess as submitGatedFormSuccess'], + ], }, listeners: ({ actions, values }) => ({ formSubmitRequest: () => { @@ -52,6 +55,9 @@ export const AppSearchGateLogic = kea { + window.location.reload(); + }, }), path: ['enterprise_search', 'app_search', 'gate_form'], diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/gated_form.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/gated_form.tsx index b07e1bf99d610..195f3377f1bb6 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/gated_form.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/gated_form.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React, { Fragment } from 'react'; +import React, { Fragment, useCallback } from 'react'; import { useActions, useValues } from 'kea'; @@ -537,10 +537,14 @@ export const WorkplaceSearchGate: React.FC = () => { useActions(WorkplaceSearchGateLogic); const { feature, participateInUXLabs } = useValues(WorkplaceSearchGateLogic); + const onSubmitForm = useCallback((e: React.FormEvent) => { + e.preventDefault(); + formSubmitRequest(); + }, []); return ( - + {i18n.translate('xpack.enterpriseSearch.workplaceSearch.gateForm.features.Label', { defaultMessage: 'What Workplace Search feature are you looking to use?', @@ -685,12 +689,7 @@ export const WorkplaceSearchGate: React.FC = () => { - formSubmitRequest()} - > + {i18n.translate('xpack.enterpriseSearch.workplaceSearch.gateForm.submit', { defaultMessage: 'Submit', })} diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/gated_form_logic.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/gated_form_logic.ts index 9a7177a17c330..326845fae009e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/gated_form_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/gated_form_logic.ts @@ -36,7 +36,10 @@ export const WorkplaceSearchGateLogic = kea< setParticipateInUXLabs: (participateInUXLabs) => ({ participateInUXLabs }), }, connect: { - actions: [UpdateGatedFormDataApiLogic, ['makeRequest as submitGatedFormDataRequest']], + actions: [ + UpdateGatedFormDataApiLogic, + ['makeRequest as submitGatedFormDataRequest', 'apiSuccess as submitGatedFormSuccess'], + ], }, listeners: ({ actions, values }) => ({ formSubmitRequest: () => { @@ -49,6 +52,9 @@ export const WorkplaceSearchGateLogic = kea< }); } }, + submitGatedFormSuccess: () => { + window.location.reload(); + }, }), path: ['enterprise_search', 'workplace_search', 'gate_form'],