Skip to content

Instantly share code, notes, and snippets.

@prinzdezibel
Last active January 15, 2018 10:55
Show Gist options
  • Save prinzdezibel/e7db9089fe96c86f6d0e1aefd2dadb1f to your computer and use it in GitHub Desktop.
Save prinzdezibel/e7db9089fe96c86f6d0e1aefd2dadb1f to your computer and use it in GitHub Desktop.
import { replaceComponent, getHOCs, composeWithTracker } from "@reactioncommerce/reaction-components";
import ProductsComponent from "../../components/product-variant/products";
/*
* Customized version of imports/plugins/included/product-variant/containers/productsContainer.js
* It subscribes to featured products only for landing page section "Products we love"
*/
function composer(props, onData) {
window.prerenderReady = false;
let canLoadMoreProducts = false;
// -------------- %< --------------------
// more stuff
// -------------- %< --------------------
const queryParams = Object.assign({}, tags, Reaction.Router.current().queryParams, shopIds);
// BOF: swag shop featuredProduct filter
queryParams.featuredProductLabel = ""; // subscribe to all featured products, regardless of label
const swagShopScrollLimit = 3; // Only interested in first 3 products for "Products we love" section
const productsSubscription = Meteor.subscribe("Products", swagShopScrollLimit, queryParams, sort, editMode);
// EOF: swag shop featuredProduct filter
// -------------- %< --------------------
// more stuff
// -------------- %< --------------------
onData(null, {
productsSubscription,
products: stateProducts,
canLoadMoreProducts
});
}
const higherOrderFuncs = getHOCs("Products");
// We are interested in replacing the composer HOC only.
higherOrderFuncs[0] = composeWithTracker(composer);
replaceComponent("Products", ProductsComponent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment