fix: soo many lint errors

This commit is contained in:
Max Richter
2025-11-03 00:03:27 +01:00
parent c13420c3ab
commit 696082250d
41 changed files with 373 additions and 500 deletions

View File

@@ -1,14 +1,17 @@
import { useEffect, useRef } from "preact/hooks";
export function useTraceUpdate(props) {
export function useTraceUpdate(props: Record<string, unknown>) {
const prev = useRef(props);
useEffect(() => {
const changedProps = Object.entries(props).reduce((ps, [k, v]) => {
if (prev.current[k] !== v) {
ps[k] = [prev.current[k], v];
}
return ps;
}, {});
const changedProps = Object.entries(props).reduce(
(ps: Record<string, unknown>, [k, v]) => {
if (prev.current[k] !== v) {
ps[k] = [prev.current[k], v];
}
return ps;
},
{},
);
if (Object.keys(changedProps).length > 0) {
console.log("Changed props:", changedProps);
}