Files
calendar/packages/lib/hooks/useTraceUpdate.ts
Volnei MunhozGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
92d2b59946 fix: replace @ts-ignore with @ts-expect-error to fix biome lint errors (#26849)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-01-14 19:05:57 -03:00

17 lines
481 B
TypeScript

import { useRef, useEffect } from "react";
export function useTraceUpdate(props: { [s: string]: unknown } | ArrayLike<unknown>) {
const prev = useRef(props);
useEffect(() => {
const changedProps = Object.entries(props).reduce((ps, [k, v]) => {
// @ts-expect-error TODO: fix this
if (prev.current[k] !== v) {
// @ts-expect-error TODO: fix this
ps[k] = [prev.current[k], v];
}
return ps;
}, {});
prev.current = props;
});
}