diff --git a/packages/vulcan-core/lib/modules/containers/withDocument.js b/packages/vulcan-core/lib/modules/containers/withDocument.js index 71d9deaec..21885a4bb 100644 --- a/packages/vulcan-core/lib/modules/containers/withDocument.js +++ b/packages/vulcan-core/lib/modules/containers/withDocument.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { graphql } from 'react-apollo'; import gql from 'graphql-tag'; -import { getSetting, getFragment, getFragmentName, Collections } from 'meteor/vulcan:core'; +import { getSetting, getFragment, getFragmentName, getCollection } from 'meteor/vulcan:core'; export default function withDocument (options) { @@ -10,8 +10,7 @@ export default function withDocument (options) { queryName = options.queryName || `${collection.options.collectionName}SingleQuery`, singleResolverName = collection.options.resolvers.single && collection.options.resolvers.single.name; - const collection = options.collection - || Collections.find(({ options: { collectionName: name }}) => name === collectionName ); + const collection = options.collection || getCollection(collectionName); let fragment; diff --git a/packages/vulcan-core/lib/modules/containers/withList.js b/packages/vulcan-core/lib/modules/containers/withList.js index ec24f2927..f0e5c40a3 100644 --- a/packages/vulcan-core/lib/modules/containers/withList.js +++ b/packages/vulcan-core/lib/modules/containers/withList.js @@ -38,7 +38,7 @@ import React, { Component } from 'react'; import { withApollo, graphql } from 'react-apollo'; import gql from 'graphql-tag'; import update from 'immutability-helper'; -import { getSetting, getFragment, getFragmentName, Collections } from 'meteor/vulcan:core'; +import { getSetting, getFragment, getFragmentName, getCollection } from 'meteor/vulcan:core'; import Mingo from 'mingo'; import compose from 'recompose/compose'; import withState from 'recompose/withState'; @@ -56,8 +56,7 @@ const withList = (options) => { extraQueries, } = options; - const collection = options.collection - || Collections.find(({ options: { collectionName: name }}) => name === collectionName ); + const collection = options.collection || getCollection(collectionName); const queryName = options.queryName || `${collection.options.collectionName}ListQuery`; const listResolverName = collection.options.resolvers.list && collection.options.resolvers.list.name;