"use strict";

exports.__esModule = true;
exports.useCreateFilterCollection = useCreateFilterCollection;
exports.useFilterCollection = useFilterCollection;
var _react = require("react");
var _react2 = require("@wix/bex-core/react");
function useCreateFilterCollection() {
  const createCollection = (0, _react2.useCreateCollection)();
  return (0, _react.useCallback)((filter, config) => {
    return createCollection({
      itemKey: filter.itemKey,
      itemName: filter.itemName,
      ...config,
      fetchErrorMessage: () => null,
      filters: config.filters ?? {}
    });
  }, []);
}
function useFilterCollection(filter, config) {
  const createFilterCollection = useCreateFilterCollection();
  const [collection] = (0, _react.useState)(() => createFilterCollection(filter, {
    ...config,
    queryOptions: {
      refetchOnMount: false,
      retryOnMount: false
    }
  }));
  return collection;
}
//# sourceMappingURL=useFilterCollection.js.map