Explore: keep query when changing datasources (#13042)

- clear `edited` state for each query when a new datasource is set
This commit is contained in:
David 2018-08-30 09:05:45 +02:00 committed by Torkel Ödegaard
parent 552a61b6ae
commit b8e6817732

View File

@ -173,6 +173,12 @@ export class Explore extends React.Component<any, ExploreState> {
datasource.init();
}
// Keep queries but reset edit state
const nextQueries = this.state.queries.map(q => ({
...q,
edited: false,
}));
this.setState(
{
datasource,
@ -182,6 +188,7 @@ export class Explore extends React.Component<any, ExploreState> {
supportsLogs,
supportsTable,
datasourceLoading: false,
queries: nextQueries,
},
() => datasourceError === null && this.onSubmit()
);