fix: issue with opening custom widget source editor (#35463)

This commit is contained in:
Rudraprasad Das 2024-08-07 11:49:23 +05:30 committed by GitHub
parent 43518e6d58
commit 9b59d4da17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -162,6 +162,7 @@ import {
} from "actions/activeFieldActions";
import CodeMirrorTernService from "utils/autocomplete/CodemirrorTernService";
import { getEachEntityInformation } from "ee/utils/autocomplete/EntityDefinitions";
import { getCurrentPageId } from "selectors/editorSelectors";
type ReduxStateProps = ReturnType<typeof mapStateToProps>;
type ReduxDispatchProps = ReturnType<typeof mapDispatchToProps>;
@ -1771,7 +1772,16 @@ class CodeEditor extends Component<Props, State> {
}
}
const mapStateToProps = (state: AppState, props: EditorProps) => ({
const mapStateToProps = (state: AppState, props: EditorProps) => {
const currentPageId: string = getCurrentPageId(state);
let entitiesForNavigation: EntityNavigationData = {};
if (currentPageId) {
entitiesForNavigation = getEntitiesForNavigation(
state,
props.dataTreePath?.split(".")[0],
);
}
return {
dynamicData: getDataTreeForAutocomplete(state),
datasources: state.entities.datasources,
pluginIdToPlugin: getPluginIdToPlugin(state),
@ -1782,15 +1792,13 @@ const mapStateToProps = (state: AppState, props: EditorProps) => ({
state,
getEditorIdentifier(props),
),
entitiesForNavigation: getEntitiesForNavigation(
state,
props.dataTreePath?.split(".")[0],
),
entitiesForNavigation,
featureFlags: selectFeatureFlags(state),
datasourceTableKeys: getAllDatasourceTableKeys(state, props.dataTreePath),
installedLibraries: selectInstalledLibraries(state),
focusedProperty: getFocusablePropertyPaneField(state),
});
};
};
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any