Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

MISC: Fix connector modal selection (#1465)

Chandrasekharan Mbd9f0a6f0685
diff --git a/frontend/src/components/agency/configure-connector-modal/ConfigureConnectorModal.jsx b/frontend/src/components/agency/configure-connector-modal/ConfigureConnectorModal.jsx
index 00d625238..99f8d395d 100644
--- a/frontend/src/components/agency/configure-connector-modal/ConfigureConnectorModal.jsx
+++ b/frontend/src/components/agency/configure-connector-modal/ConfigureConnectorModal.jsx
@@ -44,6 +44,20 @@ function ConfigureConnectorModal({
setActiveKey("1"); // default value
}
}, [open, connectorMetadata]);
+
+ // Auto-select the configured connector when modal opens
+ useEffect(() => {
+ if (open && connDetails?.connector_id && filteredList?.length > 0) {
+ const configuredConnector = filteredList.find(
+ (item) => item?.key === connDetails?.connector_id
+ );
+
+ if (configuredConnector) {
+ setSelectedId(connDetails?.connector_id);
+ setSelectedItemName(configuredConnector?.label);
+ }
+ }
+ }, [open, connDetails, filteredList]);
const { setPostHogCustomEvent, posthogConnectorEventText } =
usePostHogEvents();
@@ -66,7 +80,7 @@ function ConfigureConnectorModal({
const setUpdatedTabOptions = (tabOption) => {
setTabItems((prevTabOptions) => {
// Check if inputOption already exists in prevTabOptions
- if (prevTabOptions.some((opt) => opt.key === tabOption.key)) {
+ if (prevTabOptions.some((opt) => opt?.key === tabOption?.key)) {
return prevTabOptions; // Return previous state unchanged
} else {
// Create a new array with the existing options and the new option
@@ -78,9 +92,9 @@ function ConfigureConnectorModal({
useEffect(() => {
const updatedTabItems = tabItems.map((item) => {
- if (item.key === "2") {
+ if (item?.key === "2") {
item.visible = connType === "FILESYSTEM";
- } else if (item.key === "MANUALREVIEW") {
+ } else if (item?.key === "MANUALREVIEW") {
item.disabled =
!connectorId || connDetails?.connector_id !== selectedId;
item.visible = connType === "DATABASE" || connType === "MANUALREVIEW";
@@ -94,7 +108,7 @@ function ConfigureConnectorModal({
useEffect(() => {
const updatedTabItems = tabItems.map((item) => {
- if (item.key === "MANUALREVIEW") {
+ if (item?.key === "MANUALREVIEW") {
item.disabled =
!connectorId || connDetails?.connector_id !== selectedId;
}
@@ -118,7 +132,7 @@ function ConfigureConnectorModal({
}
}, []);
const handleSelectItem = (e) => {
- const id = e.key;
+ const id = e?.key;
setSelectedId(id?.toString());
setActiveKey("1");