diff --git a/apps/opik-frontend/src/components/pages-shared/traces/TracesPathsAutocomplete/TracesPathsAutocomplete.tsx b/apps/opik-frontend/src/components/pages-shared/traces/TracesPathsAutocomplete/TracesPathsAutocomplete.tsx index ca0853bc3d..c5fab10e99 100644 --- a/apps/opik-frontend/src/components/pages-shared/traces/TracesPathsAutocomplete/TracesPathsAutocomplete.tsx +++ b/apps/opik-frontend/src/components/pages-shared/traces/TracesPathsAutocomplete/TracesPathsAutocomplete.tsx @@ -37,22 +37,19 @@ const TracesPathsAutocomplete: React.FC = ({ const items = useMemo(() => { return uniq( - (data?.content || []).reduce( - (acc, d) => { - return acc.concat( - rootKeys.reduce( - (internalAcc, key) => - internalAcc.concat( - isObject(d[key]) || isArray(d[key]) - ? getJSONPaths(d[key], key) - : [], - ), - [], - ), - ); - }, - [...rootKeys], - ), + (data?.content || []).reduce((acc, d) => { + return acc.concat( + rootKeys.reduce( + (internalAcc, key) => + internalAcc.concat( + isObject(d[key]) || isArray(d[key]) + ? getJSONPaths(d[key], key) + : [], + ), + [], + ), + ); + }, []), ) .filter((p) => value ? p.toLowerCase().includes(value.toLowerCase()) : true, diff --git a/apps/opik-frontend/src/lib/utils.ts b/apps/opik-frontend/src/lib/utils.ts index f89245e88f..5d52ebd48b 100644 --- a/apps/opik-frontend/src/lib/utils.ts +++ b/apps/opik-frontend/src/lib/utils.ts @@ -57,10 +57,8 @@ export const getJSONPaths = ( : key; if (isArray(value)) { - results.push(path); getJSONPaths(value, path, results); } else if (isObject(value)) { - results.push(path); getJSONPaths(value, path, results); } else { results.push(path);