Hi
Based on other DataSources I see that I can use the componentDidMount as a way to get data in support of the QueryEditor and set the state.
However I can’t seem to get the hook to be invoked
I’m using the toolkit.
type Props = QueryEditorProps<DataSource, MyQuery, MyDataSourceOptions>;
interface State {
selectedConfig: SelectableValue<{ configId: Guid; configName: string }>;
}
export class QueryEditor extends PureComponent<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
selectedConfig: { value: { ConfigId: Guid.createEmpty(),configName: '' } },
};
}
componentDidMount?(): void {
const { datasource } = this.props;
datasource.myAPIThatReturnsAPromise().then((response) => {
if (response.status === 200) {
const config = JSON.parse(JSON.stringify(response.data));
this.setState({
...
});
}
});
}