Skip to content

Conversation

frano-m
Copy link
Contributor

@frano-m frano-m commented Aug 14, 2025

Closes #632.

This pull request enhances the flexibility of the TanStack table filter adapter by introducing support for category groups and improving how category filters are constructed. The main changes focus on allowing multiple category groups, making the system more extensible and modular.

Support for category groups and improved filter construction:

  • Added ColumnFiltersTableMeta type to extend TanStack's TableMeta with optional categoryGroups, enabling the use of grouped category filters.
  • Updated buildColumnFilters to check for categoryGroups in table meta; if present, it builds filters from groups, otherwise it falls back to a single group with all filterable columns.
  • Introduced helper functions: buildCategoryConfigs, buildCategoryFilters, mapCategoryConfig, and mapCategoryFilter to modularize and clarify the process of mapping table columns to category configs and filters. [1] [2]
  • Enhanced mapColumnToCategoryView to accept an optional categoryConfig and merge its properties, allowing for more customizable category views.
image

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the TanStack table filter adapter to support grouped column filters, allowing for more flexible and modular filter organization. The changes introduce the ability to define multiple category groups through table metadata while maintaining backward compatibility.

  • Added support for category groups through new ColumnFiltersTableMeta type extension
  • Refactored filter building logic to handle both grouped and ungrouped scenarios
  • Introduced helper functions to modularize the mapping between table columns and category configurations

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
utils.ts Added category group support with new helper functions and refactored buildColumnFilters to handle both grouped and single-group scenarios
types.ts Extended TanStack's TableMeta with optional categoryGroups property to enable grouped filtering

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

[]
);

if (categoryViews.length === 0) return;
Copy link
Preview

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The function returns undefined when no category views are found, but the return type is 'CategoryFilter | undefined'. Consider explicitly returning undefined for clarity: 'return undefined;'

Suggested change
if (categoryViews.length === 0) return;
if (categoryViews.length === 0) return undefined;

Copilot uses AI. Check for mistakes.

@NoopDog NoopDog merged commit 23c54e9 into main Aug 19, 2025
2 checks passed
@frano-m frano-m deleted the fran/632-column-filter-adapter branch August 19, 2025 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update ColumnFiltersAdapter to handle grouping of column filters
2 participants