From 03ee37816022eda5a0d772f7a94d4e8c634f7ba5 Mon Sep 17 00:00:00 2001 From: Kaosiso Ezealigo Date: Mon, 29 Apr 2024 07:51:26 +0100 Subject: [PATCH] fixed issue when leaving playground after adding new variant --- agenta-web/src/components/Playground/Playground.tsx | 1 + agenta-web/src/components/Playground/Views/ParametersView.tsx | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/agenta-web/src/components/Playground/Playground.tsx b/agenta-web/src/components/Playground/Playground.tsx index 2985a0f869..70110249c1 100644 --- a/agenta-web/src/components/Playground/Playground.tsx +++ b/agenta-web/src/components/Playground/Playground.tsx @@ -86,6 +86,7 @@ const Playground: React.FC = () => { ) setVariants((prevState: any) => [...prevState, newVariant]) setActiveKey(updateNewVariantName) + setUnsavedVariants((prev) => ({...prev, [newVariant.variantName!]: false})) } catch (error) { message.error("Failed to add new variant. Please try again later.") console.error("Error adding new variant:", error) diff --git a/agenta-web/src/components/Playground/Views/ParametersView.tsx b/agenta-web/src/components/Playground/Views/ParametersView.tsx index 397dbeeaf7..04c3899f14 100644 --- a/agenta-web/src/components/Playground/Views/ParametersView.tsx +++ b/agenta-web/src/components/Playground/Views/ParametersView.tsx @@ -99,10 +99,6 @@ const ParametersView: React.FC = ({ const [revisionNum, setRevisionNum] = useQueryParam("revision") const [promptRevisions, setPromptRevisions] = useState([]) - useEffect(() => { - onStateChange(variant.persistent === false) - }, []) - const onChange = (param: Parameter, newValue: number | string) => { handleParamChange(param.name, newValue) }