Files
pinkudex/components/select/RegisterVisible.tsx
T
2026-05-26 22:46:00 +02:00

21 lines
495 B
TypeScript

"use client";
import { useEffect } from "react";
import { usePathname } from "next/navigation";
import { useSelection } from "./SelectionProvider";
export function RegisterVisible({ ids }: { ids: number[] }) {
const pathname = usePathname();
const { clear, setVisibleIds } = useSelection();
useEffect(() => {
setVisibleIds(ids);
return () => setVisibleIds([]);
}, [ids, setVisibleIds]);
useEffect(() => {
return () => clear();
}, [pathname, clear]);
return null;
}