Commit 09b036dc by Hugo Häggmark

fix: update datasource in componentDidUpdate

Closes #15751
parent a73663de
...@@ -64,6 +64,14 @@ export class DataSourceSettingsPage extends PureComponent<Props, State> { ...@@ -64,6 +64,14 @@ export class DataSourceSettingsPage extends PureComponent<Props, State> {
await loadDataSource(pageId); await loadDataSource(pageId);
} }
componentDidUpdate(prevProps: Props) {
const { dataSource } = this.props;
if (prevProps.dataSource !== dataSource) {
this.setState({ dataSource });
}
}
onSubmit = async (evt: React.FormEvent<HTMLFormElement>) => { onSubmit = async (evt: React.FormEvent<HTMLFormElement>) => {
evt.preventDefault(); evt.preventDefault();
...@@ -95,9 +103,7 @@ export class DataSourceSettingsPage extends PureComponent<Props, State> { ...@@ -95,9 +103,7 @@ export class DataSourceSettingsPage extends PureComponent<Props, State> {
}; };
onModelChange = (dataSource: DataSourceSettings) => { onModelChange = (dataSource: DataSourceSettings) => {
this.setState({ this.setState({ dataSource });
dataSource: dataSource,
});
}; };
isReadOnly() { isReadOnly() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment