import { useEffect } from "react";
import { useDispatch, useSelector } from "../store/redux-separate-context";
import { fetchInfoAction } from "../domains/chart/actions";
import { selectRegistry } from "../domains/global/selectors";
export const useInfo = (shouldUseInfo) => {
    var _a;
    const registry = useSelector(selectRegistry);
    const hasStartedInfo = ((_a = registry) === null || _a === void 0 ? void 0 : _a.hasStartedInfo) || false;
    const dispatch = useDispatch();
    useEffect(() => {
        if (shouldUseInfo && !hasStartedInfo) {
            dispatch(fetchInfoAction.request({
                poll: false,
            }));
        }
    }, [dispatch, hasStartedInfo, shouldUseInfo]);
};
//# sourceMappingURL=use-info.js.map