Skip to content

Commit 83ebe5a

Browse files
liujupingJackLian
authored andcommitted
fix: fixed the problem that the data source panel did not display the default value when it was initialized
1 parent 6782bfb commit 83ebe5a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • packages/plugin-datasource-pane/src/pane

packages/plugin-datasource-pane/src/pane/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ export interface DataSource {
3232
list: InterpretDataSourceConfig[];
3333
}
3434

35-
const stateService = createStateService();
36-
3735
export { DataSourceForm } from '../components/DataSourceForm';
3836

3937
const PLUGIN_NAME = 'dataSourcePane';
@@ -83,6 +81,8 @@ export default class DataSourcePanePlugin extends PureComponent<
8381
exportPlugins: [],
8482
};
8583

84+
stateService = createStateService();
85+
8686
state = {
8787
active: false,
8888
panelKey: 1,
@@ -110,11 +110,11 @@ export default class DataSourcePanePlugin extends PureComponent<
110110
}
111111

112112
componentDidMount() {
113-
stateService.start();
113+
this.stateService.start();
114114
}
115115

116116
componentWillUnmount() {
117-
stateService.stop();
117+
this.stateService.stop();
118118
}
119119

120120
handleSchemaChange = (schema: DataSource) => {
@@ -166,7 +166,7 @@ export default class DataSourcePanePlugin extends PureComponent<
166166
return (
167167
<EditorContext.Provider value={{ project, logger, setters }}>
168168
<DataSourcePaneContext.Provider
169-
value={{ stateService, dataSourceTypes }}
169+
value={{ stateService: this.stateService, dataSourceTypes }}
170170
>
171171
<ErrorBoundary
172172
onError={onError}

0 commit comments

Comments
 (0)