Skip to content

Commit

Permalink
Fix other stores not showing in brand store (#4366)
Browse files Browse the repository at this point in the history
  • Loading branch information
steverydz authored Aug 4, 2023
1 parent 24fa390 commit 0d4ffd8
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions static/js/brand-store/components/Snaps/Snaps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,14 @@ function SnapsSlice() {
const storeIds: Array<string> = [];

snaps.forEach((snap) => {
if (snap.store === "ubuntu" || snap.store === id) {
return;
}

if (!storeIds.includes(snap.store)) {
storeIds.push(snap.store);
}

if (snap?.["other-stores"]?.length) {
snap["other-stores"].forEach((otherStoreId) => {
if (otherStoreId !== id && !storeIds.includes(otherStoreId)) {
Expand Down Expand Up @@ -259,10 +267,24 @@ function SnapsSlice() {
return {
id: storeId,
name: getStoreName(storeId),
snaps: snaps.filter(
(snap) =>
snap["other-stores"] && snap["other-stores"].includes(storeId)
),
snaps: snaps.filter((snap) => {
if (storeId === "ubuntu") {
return false;
}

if (snap.store === storeId) {
return true;
}

if (
snap["other-stores"] &&
snap["other-stores"].includes(storeId)
) {
return true;
}

return false;
}),
};
})
);
Expand Down

0 comments on commit 0d4ffd8

Please sign in to comment.