◐ Shell
clean mode source ↗

fix: Resolve UI build warnings by franciscojavierarceo · Pull Request #6531 · feast-dev/feast

@@ -1,4 +1,10 @@ import React, { useState, useContext, useEffect } from "react"; import React, { useState, useContext, useEffect, useCallback, useMemo, } from "react"; import { useParams } from "react-router-dom"; import { EuiCallOut, Expand All @@ -7,7 +13,6 @@ import { EuiFlexItem, EuiButton, EuiPanel, EuiTitle, EuiText, EuiLoadingSpinner, EuiBasicTable, Expand Down Expand Up @@ -45,17 +50,23 @@ const ClassificationMethod = () => { const [pageSize, setPageSize] = useState(25);
const spec = data?.object?.spec || data?.spec || {}; const labelFields: { name: string; valueType?: string }[] = spec.features || []; const entities: string[] = spec.entityColumns?.length ? spec.entityColumns.map((ec: { name: string }) => ec.name) : spec.entities || []; const labelFields: { name: string; valueType?: string }[] = useMemo( () => spec.features || [], [spec.features], ); const entities: string[] = useMemo( () => spec.entityColumns?.length ? spec.entityColumns.map((ec: { name: string }) => ec.name) : spec.entities || [], [spec.entityColumns, spec.entities], );
const configuredValues = annotationConfig?.label_values || {}; const fieldRoles = annotationConfig?.field_roles || {}; const labelWidgets = annotationConfig?.label_widgets || {};
const fetchLabels = async () => { const fetchLabels = useCallback(async () => { setIsLoading(true); setError(null); try { Expand Down Expand Up @@ -84,13 +95,13 @@ const ClassificationMethod = () => { } finally { setIsLoading(false); } }; }, [labelViewName, registryUrl]);
useEffect(() => { if (labelViewName) { fetchLabels(); } }, [labelViewName]); }, [labelViewName, fetchLabels]);
const handleFieldChange = (rowId: string, field: string, value: string) => { setRows((prev) => Expand Down Expand Up @@ -186,7 +197,7 @@ const ClassificationMethod = () => { URL.revokeObjectURL(url); };
const filteredRows = React.useMemo(() => { const filteredRows = useMemo(() => { if (!searchQuery.trim()) return rows; const q = searchQuery.toLowerCase(); return rows.filter((row) => Expand All @@ -198,12 +209,12 @@ const ClassificationMethod = () => { ); }, [rows, searchQuery]);
const paginatedRows = React.useMemo(() => { const paginatedRows = useMemo(() => { const start = pageIndex * pageSize; return filteredRows.slice(start, start + pageSize); }, [filteredRows, pageIndex, pageSize]);
const uniqueValuesForField = React.useMemo(() => { const uniqueValuesForField = useMemo(() => { const result: Record<string, string[]> = {}; labelFields.forEach((field) => { const values = new Set<string>(); Expand Down