Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #137 from influxdata/fix/more-alert-issues
Browse files Browse the repository at this point in the history
fix: more alerting issues with mutation
  • Loading branch information
helenosheaa authored May 2, 2023
2 parents bf8501e + c8ef077 commit 32c70d8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flightsql-datasource",
"version": "1.0.2",
"version": "1.0.3",
"description": "",
"scripts": {
"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",
Expand Down
3 changes: 2 additions & 1 deletion src/components/BuilderView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ export function BuilderView({query, datasource, onChange, fromRawSql}: any) {

useEffect(() => {
if (where) {
handleWhereChange(where, setWhereValues, whereValues)
const copyWheres = [...whereValues]
handleWhereChange(where, setWhereValues, copyWheres)
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [where])
Expand Down
17 changes: 13 additions & 4 deletions src/components/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@ export const handleColumnChange = (column: any, setColumnValues: any, columnValu
if (column.index === undefined) {
column.index = lastIndex
}
columnValues[column.index]['value'] = column?.value
setColumnValues(columnValues)
const newColumnValues = [
...columnValues.slice(0, column.index),
{
value: column?.value
},
]
setColumnValues(newColumnValues)
}

export const addColumns = (setColumnValues: any, columnValues: any) => {
Expand All @@ -66,8 +71,12 @@ export const removeColumns = (i: any, setColumnValues: any, columnValues: any) =
}

export const handleWhereChange = (where: any, setWhereValues: any, whereValues: any) => {
let newWhereValues = [...whereValues]
newWhereValues[where.index]['value'] = where.value
const newWhereValues = [
...whereValues.slice(0, where.index),
{
value: where?.value
},
]
setWhereValues(newWhereValues)
}

Expand Down

0 comments on commit 32c70d8

Please sign in to comment.