diff --git a/agenta-web/src/components/pages/observability/drawer/TestsetDrawer.tsx b/agenta-web/src/components/pages/observability/drawer/TestsetDrawer.tsx
index 02d489dae7..68d4777167 100644
--- a/agenta-web/src/components/pages/observability/drawer/TestsetDrawer.tsx
+++ b/agenta-web/src/components/pages/observability/drawer/TestsetDrawer.tsx
@@ -117,6 +117,15 @@ const TestsetDrawer = ({onClose, data, ...props}: Props) => {
setTableRows(data.csvdata)
}
}
+
+ if (mappingOptions.length > 0 && value) {
+ setMappingData((prevMappingData) =>
+ mappingOptions.map((item, index) => ({
+ ...prevMappingData[index],
+ data: item.value,
+ })),
+ )
+ }
} catch (error) {
message.error("Failed to laod Test sets!")
}
@@ -169,18 +178,6 @@ const TestsetDrawer = ({onClose, data, ...props}: Props) => {
return Array.from(uniquePaths).map((item) => ({value: item}))
}, [data])
- useEffect(() => {
- // auto render mapping component with data
- if (mappingOptions.length > 0) {
- setMappingData((prevMappingData) =>
- mappingOptions.map((item, index) => ({
- ...prevMappingData[index],
- data: item.value,
- })),
- )
- }
- }, [mappingOptions])
-
const columnOptions = useMemo(() => {
const selectedColumns = mappingData
.map((item) => item.column)
@@ -435,99 +432,111 @@ const TestsetDrawer = ({onClose, data, ...props}: Props) => {
Mapping
-
- {mappingData.map((data, idx) => (
-
-