diff --git a/ui/src/dashboards/components/CellEditorOverlay.js b/ui/src/dashboards/components/CellEditorOverlay.js index 81672cc0cd..440d9d137c 100644 --- a/ui/src/dashboards/components/CellEditorOverlay.js +++ b/ui/src/dashboards/components/CellEditorOverlay.js @@ -66,8 +66,12 @@ class CellEditorOverlay extends Component { const nextQuery = queryModifier(query, payload) const nextQueries = queriesWorkingDraft.map( - q => (q.id === query.id ? nextQuery : q) + q => + q.id === query.id + ? {...nextQuery, source: this.nextSource(q, nextQuery)} + : q ) + this.setState({queriesWorkingDraft: nextQueries}) } @@ -269,6 +273,14 @@ class CellEditorOverlay extends Component { return querySource || source } + nextSource = (prevQuery, nextQuery) => { + if (nextQuery.source) { + return nextQuery.source + } + + return prevQuery.source + } + render() { const { onCancel,