import { useState } from 'react'; import { useRereadWhileSeen } from './useRereadWhileSeen'; /** * One reread signal for a surface's agreement rows, so an answer the patient gives elsewhere reaches a panel left open. * One timer serves every row on the surface; nothing runs while the page is hidden, and it reads once on return. */ export const useAgreementReread = (enabled: boolean): number => { const [reread, setReread] = useState(0); useRereadWhileSeen(enabled, async () => { setReread((current) => current + 1); }); return reread; };