import { useRecoilCallback } from 'recoil';
import { selectorFamilyMembersRegistry, selectorFamilyRegistry } from './store';
/**
 * Helper hook to refresh a selector by its key
 */
export default function useRefreshSelector() {
    return useRecoilCallback(({ refresh }) => {
        return (key, extras) => {
            var _a;
            const family = selectorFamilyRegistry.get(key);
            if (family) {
                const selector = (_a = selectorFamilyMembersRegistry.get(family)) === null || _a === void 0 ? void 0 : _a.get(extras);
                if (selector) {
                    refresh(selector);
                }
            }
        };
    });
}
//# sourceMappingURL=use-refresh-selector.js.map