Rebuild builder configs when changing time range

pull/10616/head
Christopher Henn 2018-12-06 14:37:01 -08:00 committed by Chris Henn
parent 9095d58424
commit 4ab8a81454
1 changed files with 23 additions and 2 deletions

View File

@ -122,10 +122,31 @@ export const timeMachineReducer = (
case 'SET_TIME_RANGE': {
const {timeRange} = action.payload
const {view} = state
// TODO(chnn): Rebuild the BuilderConfig for each query
const rebuildConfig = query => ({
...query,
text: buildQuery(query.builderConfig, timeRange.duration),
})
return {...state, timeRange}
const draftQueries = state.draftQueries.map(rebuildConfig)
const queries = view.properties.queries.map(rebuildConfig)
const newView = {
...view,
properties: {
...view.properties,
queries,
},
}
return {
...state,
timeRange,
view: newView,
draftQueries,
submitToken: Date.now(),
}
}
case 'SET_VIEW_TYPE': {