From 2a8d672ee03dc10625d5bf2d6c234b3c1a1e4582 Mon Sep 17 00:00:00 2001 From: Kiran Ashok Date: Fri, 5 Apr 2024 17:53:05 +0530 Subject: [PATCH] fix: not able to save datasource + module option shown in create app dropdown (#9308) --- .../src/Editor/DataSourceManager/DataSourceManager.jsx | 9 ++++++--- frontend/src/HomePage/HomePage.jsx | 7 ------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/frontend/src/Editor/DataSourceManager/DataSourceManager.jsx b/frontend/src/Editor/DataSourceManager/DataSourceManager.jsx index fa506f7375..abe6b6ca38 100644 --- a/frontend/src/Editor/DataSourceManager/DataSourceManager.jsx +++ b/frontend/src/Editor/DataSourceManager/DataSourceManager.jsx @@ -21,14 +21,17 @@ import { withTranslation, useTranslation } from 'react-i18next'; import { camelizeKeys, decamelizeKeys } from 'humps'; import { ButtonSolid } from '@/_ui/AppButton/AppButton'; import SolidIcon from '@/_ui/Icon/SolidIcons'; -import { useAppVersionStore } from '@/_stores/appVersionStore'; import { ConfirmDialog } from '@/_components'; import { deepEqual } from '../../_helpers/utils'; import { shallow } from 'zustand/shallow'; import { useDataSourcesStore } from '../../_stores/dataSourcesStore'; import { withRouter } from '@/_hoc/withRouter'; +import { useSuperStore } from '@/_stores/superStore'; +import { ModuleContext } from '@/_contexts/ModuleContext'; class DataSourceManagerComponent extends React.Component { + static contextType = ModuleContext; + constructor(props) { super(props); @@ -38,7 +41,6 @@ class DataSourceManagerComponent extends React.Component { let options = {}; let dataSourceMeta = {}; let datasourceName = ''; - if (props.selectedDataSource) { selectedDataSource = props.selectedDataSource; options = selectedDataSource.options; @@ -197,7 +199,8 @@ class DataSourceManagerComponent extends React.Component { const name = selectedDataSource.name; const kind = selectedDataSource.kind; const pluginId = selectedDataSourcePluginId; - const appVersionId = useAppVersionStore?.getState()?.editingVersion?.id; + const appVersionId = useSuperStore.getState().modules[this.context].useAppVersionStore?.getState() + ?.editingVersion?.id; const currentEnvironment = this.props.currentEnvironment?.id; const scope = this.state?.scope || selectedDataSource?.scope; diff --git a/frontend/src/HomePage/HomePage.jsx b/frontend/src/HomePage/HomePage.jsx index 476ee16e69..8b8d12339b 100644 --- a/frontend/src/HomePage/HomePage.jsx +++ b/frontend/src/HomePage/HomePage.jsx @@ -800,13 +800,6 @@ class HomePageComponent extends React.Component { data-cy="import-option-input" /> - this.setState({ showCreateModuleModal: true })} - data-cy="create-module-button" - > - {this.props.t('homePage.header.createModule', 'Create module')} -