Skip to content

Commit

Permalink
fix(pr): merging suggested PR change
Browse files Browse the repository at this point in the history
Co-authored-by: Deniz Kusefoglu <[email protected]>
  • Loading branch information
asalem1 and ebb-tide committed Jun 22, 2020
1 parent b3c4c3f commit ab3dfd3
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions ui/src/views/actions/thunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,23 @@ export const setQueryResultsForCell = (
dashboardID: string,
cellID: string,
timeMachineID: TimeMachineID
) => (dispatch, getState: GetState): Promise<void> => {
) => async (dispatch, getState: GetState): Promise<void> => {
try {
dispatch(getViewForTimeMachine(dashboardID, cellID, timeMachineID))
const state = getState()

let view = getByID<View>(state, ResourceType.Views, cellID) as QueryView

if (!view) {
dispatch(setView(cellID, RemoteDataState.Loading))
view = (await getViewAJAX(dashboardID, cellID)) as QueryView
}

dispatch(
setActiveTimeMachine(timeMachineID, {
contextID: dashboardID,
view,
})
)
const {view} = getActiveTimeMachine(state)
const queries = view.properties.queries.filter(({text}) => !!text.trim())
const queryText = queries.map(({text}) => text).join('')
Expand Down

0 comments on commit ab3dfd3

Please sign in to comment.