Skip to content

Commit

Permalink
Merge pull request #2364 from Agenta-AI/AGE-1394/-State-mix-up-in-cre…
Browse files Browse the repository at this point in the history
…ate-new-evaluator-modal

(frontend)[AGE-1394]: State mix-up in create new evaluator modal
  • Loading branch information
mmabrouk authored Dec 13, 2024
2 parents 6b34d87 + 71db0ff commit 387012f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ type EvaluatorsProps = {
onSuccess: () => void
setEvaluatorsDisplay: any
evaluatorsDisplay: string
setSelectedEvaluatorCategory: React.Dispatch<React.SetStateAction<string>>
selectedEvaluatorCategory: string
}

const useStyles = createUseStyles((theme: JSSTheme) => ({
Expand Down Expand Up @@ -74,13 +72,12 @@ const Evaluators = ({
setCloneConfig,
setEvaluatorsDisplay,
evaluatorsDisplay,
selectedEvaluatorCategory,
setSelectedEvaluatorCategory,
}: EvaluatorsProps) => {
const classes = useStyles()
const [searchTerm, setSearchTerm] = useState("")
const evaluatorTags = getEvaluatorTags()
const evaluators = useAtom(evaluatorsAtom)[0]
const [selectedEvaluatorCategory, setSelectedEvaluatorCategory] = useState("view_all")

const updatedEvaluatorConfigs = useMemo(() => {
return evaluatorConfigs.map((config) => {
Expand Down Expand Up @@ -128,7 +125,7 @@ const Evaluators = ({
<div>
<div className="flex items-center justify-between">
<Radio.Group
defaultValue={"view_all"}
defaultValue={selectedEvaluatorCategory}
className={classes.radioBtnContainer}
onChange={(e) => setSelectedEvaluatorCategory(e.target.value)}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ const EvaluatorsModal = ({
"evaluator_view",
"list",
)
const [selectedEvaluatorCategory, setSelectedEvaluatorCategory] = useState("view_all")
const [selectedTestset, setSelectedTestset] = useState("")

const evalConfigFetcher = () => {
Expand Down Expand Up @@ -114,8 +113,6 @@ const EvaluatorsModal = ({
setCloneConfig={setCloneConfig}
setEvaluatorsDisplay={setEvaluatorsDisplay}
evaluatorsDisplay={evaluatorsDisplay}
selectedEvaluatorCategory={selectedEvaluatorCategory}
setSelectedEvaluatorCategory={setSelectedEvaluatorCategory}
/>
),
},
Expand All @@ -128,8 +125,6 @@ const EvaluatorsModal = ({
setSelectedEvaluator={setSelectedEvaluator}
setEvaluatorsDisplay={setEvaluatorsDisplay}
evaluatorsDisplay={evaluatorsDisplay}
selectedEvaluatorCategory={selectedEvaluatorCategory}
setSelectedEvaluatorCategory={setSelectedEvaluatorCategory}
/>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ type NewEvaluatorProps = {
setSelectedEvaluator: React.Dispatch<React.SetStateAction<Evaluator | null>>
setEvaluatorsDisplay: any
evaluatorsDisplay: string
setSelectedEvaluatorCategory: React.Dispatch<React.SetStateAction<string>>
selectedEvaluatorCategory: string
}

const useStyles = createUseStyles((theme: JSSTheme) => ({
Expand Down Expand Up @@ -62,12 +60,11 @@ const NewEvaluator = ({
setSelectedEvaluator,
setEvaluatorsDisplay,
evaluatorsDisplay,
selectedEvaluatorCategory,
setSelectedEvaluatorCategory,
}: NewEvaluatorProps) => {
const classes = useStyles()
const [searchTerm, setSearchTerm] = useState("")
const evaluatorTags = getEvaluatorTags()
const [selectedEvaluatorCategory, setSelectedEvaluatorCategory] = useState("view_all")

const filteredEvaluators = useMemo(() => {
let filtered = evaluators
Expand Down Expand Up @@ -103,7 +100,7 @@ const NewEvaluator = ({
<div>
<div className="flex items-center justify-between">
<Radio.Group
defaultValue={"view_all"}
defaultValue={selectedEvaluatorCategory}
className={classes.radioBtnContainer}
onChange={(e) => setSelectedEvaluatorCategory(e.target.value)}
>
Expand Down

0 comments on commit 387012f

Please sign in to comment.