import { useCallback, useState } from 'react';
import { useCreateCollection, } from '@wix/bex-core/react';
export function useCreateFilterCollection() {
    const createCollection = useCreateCollection();
    return useCallback((filter, config) => {
        return createCollection({
            itemKey: filter.itemKey,
            itemName: filter.itemName,
            ...config,
            fetchErrorMessage: () => null,
            filters: config.filters ?? {},
        });
    }, []);
}
export function useFilterCollection(filter, config) {
    const createFilterCollection = useCreateFilterCollection();
    const [collection] = useState(() => createFilterCollection(filter, {
        ...config,
        queryOptions: {
            refetchOnMount: false,
            retryOnMount: false,
        },
    }));
    return collection;
}
//# sourceMappingURL=useFilterCollection.js.map