Skip to content

Commit

Permalink
Merge pull request #951 from newsiberian/fix-productGrid-load-products
Browse files Browse the repository at this point in the history
Fix for the `productGrid` products loading
  • Loading branch information
brent-hoover committed Apr 5, 2016
2 parents e4bfe78 + ef1cfce commit 4353863
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,20 @@ Template.productGrid.helpers({
return 0;
}

let gridProducts = ReactionCore.Collections.Products.find({}).fetch();
// we are passing `ancestors: []`, because in case when we turn back from PDP
// for a moment we still subscribed to variants too, and we will get an error
// because of it, because our `productGrid` component can't work with variants
// objects.
//
// Also, we it is possible to change this selector to the following:
// `type: { $in: ["simple"] }`, but I found this way is not kind to package
// creators, because to specify they new product type, they will need to change
// this file, which broke another piece of compatibility with `reaction`
let gridProducts = ReactionCore.Collections.Products.find({
ancestors: []
// keep this, as an example
// type: { $in: ["simple"] }
}).fetch();
const products = gridProducts.sort(compare);
Template.instance().products = products;
return products;
Expand Down

0 comments on commit 4353863

Please sign in to comment.