import { useEffect } from "react";

import { maybe } from "../misc";
import useListSelector from "./useListSelector";

interface ConnectionNode {
  id: string;
}
function useBulkActions(list: ConnectionNode[]) {
  const listSelectorFuncs = useListSelector();
  useEffect(() => listSelectorFuncs.reset, [
    maybe(() => list.reduce((acc, curr) => acc + curr.id, ""))
  ]);

  return listSelectorFuncs;
}
export default useBulkActions;

import { useEffect } from "react";

import useListSelector from "./useListSelector";

interface ConnectionNode {
  id: string;
}
function useBulkActions(list: ConnectionNode[]) {
  const listSelectorFuncs = useListSelector();
  useEffect(() => listSelectorFuncs.reset, [list === undefined, list === null]);

  return listSelectorFuncs;
}
export default useBulkActions;

Reset state only if list is undefined or null
Reset state only if list is undefined or null
