Skip to content

Commit

Permalink
fix(multiple_queries): handling the case where multiple queries resul…
Browse files Browse the repository at this point in the history
…t in the output file
  • Loading branch information
asalem1 committed Jun 18, 2020
1 parent 50932e9 commit cec9b0d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ui/src/queryCache/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const hashCode = (queryText: string): string => {
export const setQueryResultsByQueryID = (queryID: string, files: string[]) =>
({
type: 'SET_QUERY_RESULTS_BY_QUERY',
queryID: hashCode(queryID),
queryID,
files,
} as const)

Expand Down
2 changes: 1 addition & 1 deletion ui/src/shared/components/TimeSeries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class TimeSeries extends Component<Props & WithRouterProps, State> {

this.pendingReload = false

const queryText = queries[0].text
const queryText = queries.map(({text}) => text).join('')
const queryID = hashCode(queryText)
if (queryID && files.length) {
onSetQueryResultsByQueryID(queryID, files)
Expand Down
4 changes: 2 additions & 2 deletions ui/src/views/actions/thunks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Libraries
import {normalize} from 'normalizr'
import {get} from 'lodash'

// APIs
import {
getView as getViewAJAX,
Expand Down Expand Up @@ -150,7 +150,7 @@ export const setQueryResultsForCell = (
const state = getState()
const {view} = getActiveTimeMachine(state)
const queries = view.properties.queries.filter(({text}) => !!text.trim())
const queryText = get(queries, '[0].text', '')
const queryText = queries.map(({text}) => text).join('')
const queryID = hashCode(queryText)
if (queryID) {
dispatch(setQueryResultsByQueryID(queryID))
Expand Down

0 comments on commit cec9b0d

Please sign in to comment.