Skip to content

Commit

Permalink
fix(MWPW-151628): fixes backwards compatibility issue (#157)
Browse files Browse the repository at this point in the history
* fix(MWPW-151628): fixes backwards compatibility issue

* fix(MWPW-151628):Fix for empty categories filter
  • Loading branch information
cmiqueo authored Jun 6, 2024
1 parent 178d0e2 commit 697345e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 33 deletions.
2 changes: 1 addition & 1 deletion dist/app.css

Large diffs are not rendered by default.

45 changes: 24 additions & 21 deletions dist/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Chimera UI Libraries - Build 0.12.2 (6/4/2024, 18:46:28)
* Chimera UI Libraries - Build 0.13.0 (6/6/2024, 08:59:58)
*
*/
/******/ (function(modules) { // webpackBootstrap
Expand Down Expand Up @@ -7507,7 +7507,7 @@ var Container = function Container(props) {

// Sorts category list based on authored order
var selectedCategories = categoryIds.map(function (id) {
return categoryList.filter(function (category) {
return categoryList && categoryList.filter(function (category) {
return category.id === id;
})[0];
});
Expand All @@ -7525,7 +7525,6 @@ var Container = function Container(props) {
* Prepends the "All products" label to the list of categories
*/
function getAllCategoryProducts() {
// if (isCategoriesContainer) return [];
var allCategories = [];
var _iteratorNormalCompletion4 = true;
var _didIteratorError4 = false;
Expand All @@ -7534,32 +7533,35 @@ var Container = function Container(props) {
try {
for (var _iterator4 = authoredCategories[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
var category = _step4.value;
var _iteratorNormalCompletion5 = true;
var _didIteratorError5 = false;
var _iteratorError5 = undefined;

try {
for (var _iterator5 = category.items[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
var item = _step5.value;
if (category && category.items) {
var _iteratorNormalCompletion5 = true;
var _didIteratorError5 = false;
var _iteratorError5 = undefined;

item.fromCategory = true;
}
} catch (err) {
_didIteratorError5 = true;
_iteratorError5 = err;
} finally {
try {
if (!_iteratorNormalCompletion5 && _iterator5.return) {
_iterator5.return();
for (var _iterator5 = category.items[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
var item = _step5.value;

item.fromCategory = true;
}
} catch (err) {
_didIteratorError5 = true;
_iteratorError5 = err;
} finally {
if (_didIteratorError5) {
throw _iteratorError5;
try {
if (!_iteratorNormalCompletion5 && _iterator5.return) {
_iterator5.return();
}
} finally {
if (_didIteratorError5) {
throw _iteratorError5;
}
}
}
}

allCategories = allCategories.concat(category.items);
allCategories = allCategories.concat(category.items);
}
}
} catch (err) {
_didIteratorError4 = true;
Expand Down Expand Up @@ -7704,6 +7706,7 @@ var Container = function Container(props) {
'div',
{ className: 'filters-category' },
authoredCategories.map(function (category) {
if (!category) return null;
var selected = '';
if (category.id === selectedCategory) {
selected = 'selected';
Expand Down
10 changes: 5 additions & 5 deletions dist/main.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/main.source.js

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions react/src/js/components/Consonant/Container/Container.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ const Container = (props) => {

// Sorts category list based on authored order
const selectedCategories = categoryIds
.map(id => categoryList.filter(category => category.id === id)[0]);
.map(id => categoryList && categoryList.filter(category => category.id === id)[0]);

return [{
group: 'All Topics',
Expand All @@ -1236,13 +1236,14 @@ const Container = (props) => {
* Prepends the "All products" label to the list of categories
*/
function getAllCategoryProducts() {
// if (isCategoriesContainer) return [];
let allCategories = [];
for (const category of authoredCategories) {
for (const item of category.items) {
item.fromCategory = true;
if (category && category.items) {
for (const item of category.items) {
item.fromCategory = true;
}
allCategories = allCategories.concat(category.items);
}
allCategories = allCategories.concat(category.items);
}
return {
group: 'All products',
Expand Down Expand Up @@ -1338,6 +1339,7 @@ const Container = (props) => {
<div className="filters-category">
{
authoredCategories.map((category) => {
if (!category) return null;
let selected = '';
if (category.id === selectedCategory) {
selected = 'selected';
Expand Down

0 comments on commit 697345e

Please sign in to comment.