From 518f1ed5338fb0b604c83d2430a16a8a9e35c039 Mon Sep 17 00:00:00 2001 From: Kaosiso Ezealigo Date: Sat, 16 Dec 2023 15:56:26 +0100 Subject: [PATCH] feat: sync resultList --- .../src/components/Playground/TestContextProvider.tsx | 7 +++++-- agenta-web/src/components/Playground/Views/TestView.tsx | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/agenta-web/src/components/Playground/TestContextProvider.tsx b/agenta-web/src/components/Playground/TestContextProvider.tsx index 721ce0e8e0..f0d45ead14 100644 --- a/agenta-web/src/components/Playground/TestContextProvider.tsx +++ b/agenta-web/src/components/Playground/TestContextProvider.tsx @@ -4,13 +4,16 @@ import React, {PropsWithChildren, createContext, useState} from "react" export const TestContext = createContext<{ testList: GenericObject[] setTestList: React.Dispatch> -}>({testList: [{}], setTestList: () => {}}) + setResultsList: React.Dispatch> + resultsList: string[] +}>({testList: [{}], setTestList: () => {}, resultsList: [], setResultsList: () => {}}) const TestContextProvider: React.FC = (props) => { const [testList, setTestList] = useState([{}]) + const [resultsList, setResultsList] = useState(testList.map(() => "")) return ( - + {props.children} ) diff --git a/agenta-web/src/components/Playground/Views/TestView.tsx b/agenta-web/src/components/Playground/Views/TestView.tsx index 5cace74633..0d4db378b9 100644 --- a/agenta-web/src/components/Playground/Views/TestView.tsx +++ b/agenta-web/src/components/Playground/Views/TestView.tsx @@ -202,8 +202,7 @@ const BoxComponent: React.FC = ({ const App: React.FC = ({inputParams, optParams, variant, isChatVariant}) => { const router = useRouter() const appId = router.query.app_id as unknown as string - const {testList, setTestList} = useContext(TestContext) - const [resultsList, setResultsList] = useState(testList.map(() => "")) + const {testList, setTestList, resultsList, setResultsList} = useContext(TestContext) const [params, setParams] = useState | null>(null) const classes = useStylesApp() const rootRef = React.useRef(null)