From d32c083392fd2279219339f8ad1e73a4da1efeae Mon Sep 17 00:00:00 2001 From: tealjulia Date: Tue, 11 Oct 2022 21:24:14 -0400 Subject: [PATCH] update isAuthFlowSelected to match authSpecification pattern --- .../ServiceForm/serviceFormContext.tsx | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/airbyte-webapp/src/views/Connector/ServiceForm/serviceFormContext.tsx b/airbyte-webapp/src/views/Connector/ServiceForm/serviceFormContext.tsx index 820be4fc64e8..510e3a83de5a 100644 --- a/airbyte-webapp/src/views/Connector/ServiceForm/serviceFormContext.tsx +++ b/airbyte-webapp/src/views/Connector/ServiceForm/serviceFormContext.tsx @@ -74,14 +74,20 @@ export const ServiceFormContextProvider: React.FC - allowOAuthConnector && - selectedConnector?.advancedAuth && - selectedConnector?.advancedAuth.predicateValue === - getIn(getValues(values), makeConnectionConfigurationPath(selectedConnector?.advancedAuth.predicateKey ?? [])), - [selectedConnector, allowOAuthConnector, values, getValues] - ); + const isAuthFlowSelected = useMemo(() => { + if (allowOAuthConnector) { + if ( + selectedConnector?.advancedAuth && + selectedConnector?.advancedAuth.predicateValue === + getIn(getValues(values), makeConnectionConfigurationPath(selectedConnector?.advancedAuth.predicateKey ?? [])) + ) { + return true; + } else if (selectedConnector?.authSpecification) { + return true; + } + } + return false; + }, [allowOAuthConnector, getValues, selectedConnector?.advancedAuth, selectedConnector?.authSpecification, values]); const authFieldsToHide = useMemo( () =>