import { useWatch, type Control, type FieldPath, type FieldValues } from "react-hook-form"; import { displayValue } from "@/lib/placeholder"; interface UoMCellProps { control: Control; /** Path to the line's unit symbol field, e.g. `lines.${index}.unitSymbol`. */ name: FieldPath; } /** * Renders a line's UoM symbol, subscribing only to that field via `useWatch` * so re-renders stay scoped to this cell instead of the whole line-items table. */ export function UoMCell({ control, name }: UoMCellProps) { const symbol = useWatch({ control, name }); return <>{displayValue(symbol)}; }