Skip to content

Commit

Permalink
biome
Browse files Browse the repository at this point in the history
  • Loading branch information
cjh1 committed Jan 21, 2025
1 parent 702d76d commit d33579d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 27 deletions.
2 changes: 1 addition & 1 deletion frontend/interactEM/src/components/pipelineflow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const PipelineFlow = () => {

setNodes((nds) => nds.concat(newNode))
},
[screenToFlowPosition, operatorDropData, handlePipelineJSONDrop],
[screenToFlowPosition, operatorDropData, handlePipelineJSONDrop, operators],
)

const handleNodesChange: OnNodesChange<Node<OperatorNodeData>> = useCallback(
Expand Down
38 changes: 17 additions & 21 deletions frontend/interactEM/src/hooks/useOperators.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
import { useEffect, useState } from "react";
import { Operator } from "../operators";
import { useEffect, useState } from "react"
import type { Operator } from "../operators"

import {
readOperators,
ReadOperatorsError,
ReadOperatorsResponse,
} from "../client";
import { readOperators, type ReadOperatorsError } from "../client"

const useOperators = () => {
const [operators, setOperators] = useState<Operator[] | null>(null);
const [error, setError] = useState<ReadOperatorsError | null>(null);
const [loading, setLoading] = useState<boolean>(false);
const [operators, setOperators] = useState<Operator[] | null>(null)
const [error, setError] = useState<ReadOperatorsError | null>(null)
const [loading, setLoading] = useState<boolean>(false)

useEffect(() => {
const fetchData = async () => {
setLoading(true);
setLoading(true)
try {
const response = await readOperators();
const response = await readOperators()
if (response.data) {
setOperators((response.data.data as Operator[]) ?? null);
setOperators((response.data.data as Operator[]) ?? null)
}
} catch (err) {
setError(err as ReadOperatorsError);
setError(err as ReadOperatorsError)
} finally {
setLoading(false);
setLoading(false)
}
};
}

fetchData();
}, []);
fetchData()
}, [])

return { operators, error, loading };
};
return { operators, error, loading }
}

export default useOperators;
export default useOperators
9 changes: 4 additions & 5 deletions frontend/interactEM/src/operators/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export interface OperatorInput {
label: string;
description: string;
label: string
description: string
}

export interface OperatorOutput {
label: string;
description: string;
label: string
description: string
}

export enum ParameterType {
Expand Down Expand Up @@ -37,4 +37,3 @@ export interface Operator {
outputs?: OperatorOutput[]
parameters?: OperatorParameter[]
}

0 comments on commit d33579d

Please sign in to comment.