Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.switchMap((data) => {
const { getState } = data;
const query = getCurrentSearchQuery(getState());
// Check if products for the current route are already available within Redux.
const productsLoaded = getProductsResult(
getState(),
{ searchPhrase: query }
).totalProductCount !== null;
if (!productsLoaded) {
// Wait for incoming products if they are not available yet.
return resultsReceived$.first();
}
return Observable.of(data);
})
.merge(searchRouteReappeared$);
.switchMap((data) => {
const { action, getState } = data;
const { categoryId } = action.route.params;
// Check if products for the current route are already available within Redux.
const productsLoaded = getProductsResult(
getState(),
{ categoryId: hex2bin(categoryId) }
).totalProductCount !== null;
if (!productsLoaded) {
// Wait for incoming products if they are not available yet.
return productsReceived$.first();
}
return Observable.of(data);
});
const mapStateToProps = (state, props) => ({
category: getCurrentCategory(state, props),
hasHeadline: !isCategoryEmpty(state, props),
hasProducts: getCategoryProductCount(state) > 0,
isFilterBarShown: isFilterBarShown(state),
isRoot: !getCurrentCategoryId(state, props),
...getProductsResult(state, props),
});
const mapStateToProps = (state, props) => ({
...getProductsResult(state, props),
});
const mapStateToProps = (state, props) => ({
...getProductsResult(state, props),
});
const mapStateToProps = state => ({
isLoading: isViewLoading(state, SEARCH_PATH),
isFilterBarShown: isFilterBarShown(state),
searchPhrase: getSearchPhrase(state),
...getProductsResult(state),
});
const mapStateToProps = state => ({
...getProductsResult(state),
});