Add local source logic to local queryStateReducer

pull/10616/head
Andrew Watkins 2017-10-04 15:43:40 -07:00
parent ebd935ef35
commit 97ee2e3047
1 changed files with 13 additions and 1 deletions

View File

@ -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,