Skip to content

Commit bbf42d2

Browse files
fix: Remove weird variable refId hardcoding
1 parent 6fa914a commit bbf42d2

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

src/components/VariableQueryEditor.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,11 @@ interface VariableQueryProps {
99
onChange: (query: HaystackVariableQuery, definition: string) => void;
1010
}
1111

12-
export const VARIABLE_REF_ID = "variable";
13-
1412
export const VariableQueryEditor: React.FC<VariableQueryProps> = ({ onChange, query: variableQuery }) => {
1513
let variableInputWidth = 30;
1614
const [query, setState] = useState(variableQuery);
1715

1816
const saveQuery = () => {
19-
// refId must match but doesn't get set originally so set should set it on every change
20-
setState({ ...query, refId: VARIABLE_REF_ID});
21-
2217
let type = query.type;
2318
let queryCmd = "";
2419
if (query.type === "eval") {
@@ -71,7 +66,7 @@ export const VariableQueryEditor: React.FC<VariableQueryProps> = ({ onChange, qu
7166
<HaystackQueryTypeSelector
7267
datasource={null}
7368
type={query.type}
74-
refId={query.refId ?? VARIABLE_REF_ID}
69+
refId={query.refId}
7570
onChange={onTypeChange}
7671
/>
7772
<HaystackQueryInput

src/datasource.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { HaystackQuery, OpsQuery, HaystackDataSourceOptions, HaystackVariableQue
1717
import { firstValueFrom, map, Observable } from 'rxjs';
1818
import { isRef, parseRef } from 'haystack';
1919
import { ComponentType } from 'react';
20-
import { VARIABLE_REF_ID, VariableQueryEditor } from 'components/VariableQueryEditor';
20+
import { VariableQueryEditor } from 'components/VariableQueryEditor';
2121

2222
export const queryTypes: QueryType[] = [
2323
{ label: 'Eval', value: 'eval', apiRequirements: ['eval'], description: 'Evaluate an Axon expression' },
@@ -130,7 +130,6 @@ export class HaystackVariableSupport extends CustomVariableSupport<DataSource, H
130130

131131
query(request: DataQueryRequest<HaystackVariableQuery>): Observable<DataQueryResponse> {
132132
let variableQuery = request.targets[0];
133-
variableQuery.refId = VARIABLE_REF_ID;
134133
let observable = this.onQuery(request);
135134
return observable.pipe(
136135
map((response) => {

0 commit comments

Comments
 (0)