Skip to content

Commit 842ed71

Browse files
authored
Merge pull request #334 from seamapi/fix-excluded-brands
2 parents f039485 + 095efe0 commit 842ed71

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ const useAvailableBrands = (
139139
})
140140
.filter((brand) => {
141141
if (brands === null) return true
142-
return brands.includes(brand) && !excludedBrands.includes(brand)
142+
return brands.includes(brand)
143+
})
144+
.filter((brand) => {
145+
return !excludedBrands.includes(brand)
143146
})
144147
.map((brand) => capitalize(brand))
145148

src/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,17 @@ export const useFilteredDeviceModels = ({
3535

3636
const query = useDeviceModels(params)
3737

38-
if (brands === null) {
39-
return query
40-
}
41-
4238
// UPSTREAM: The API does not have a brands or excludedBrands query parameter,
4339
// so selected brands are filtered here.
4440
return {
4541
...query,
46-
deviceModels: query.deviceModels?.filter(
47-
({ brand }) => brands.includes(brand) && !excludedBrands.includes(brand)
48-
),
42+
deviceModels: query.deviceModels
43+
?.filter(({ brand }) => {
44+
if (brands === null) return true
45+
return brands.includes(brand)
46+
})
47+
.filter(({ brand }) => {
48+
return !excludedBrands.includes(brand)
49+
}),
4950
}
5051
}

0 commit comments

Comments
 (0)