Skip to content

Commit d6d85e4

Browse files
authored
fix: fix incorrect labels on filters (#499) (#500)
* fix: fix incorrect labels on filters (#499) * fix: jsdoc comment (#499) ---------
1 parent 87c9e70 commit d6d85e4

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/common/categories/config/utils.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ export function findCategoryConfig<V extends VIEW_KIND>(
1313
viewKind: V,
1414
key: Category["key"],
1515
configs: CategoryConfig[]
16-
): Extract<CategoryConfig, { viewKind: V }> | undefined {
16+
): Extract<CategoryConfig, { viewKind?: V }> | undefined {
1717
return configs.find(
18-
(c): c is Extract<CategoryConfig, { viewKind: V }> =>
19-
c.viewKind === viewKind && c.key === key
18+
(c): c is Extract<CategoryConfig, { viewKind?: V }> =>
19+
// When `viewKind` is undefined, it corresponds to a `SelectCategoryConfig`.
20+
// This predicate ensures that `viewKind` is either explicitly matched or treated as undefined
21+
// for compatibility with `SelectCategoryConfig` and other explicitly defined view kinds.
22+
(c.viewKind === undefined || c.viewKind === viewKind) && c.key === key
2023
);
2124
}
2225

0 commit comments

Comments
 (0)