21 lines
495 B
TypeScript
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;
|
|
}
|