Skip to content

Commit

Permalink
Add new filters from columns if no present
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Nov 10, 2023
1 parent f0291b6 commit c5f597b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/edit-site/src/components/dataviews/view-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,17 @@ function ViewList( {
onChangeView( { ...view, search: value, page: 1 } );
},
onColumnFiltersChange: ( columnFiltersUpdater ) => {
const filters = fromTanStackColumnFilters( columnFiltersUpdater() );
const visibleFilters = [ ...view.visibleFilters ];
filters.forEach( ( filter ) => {
if ( ! view.visibleFilters?.includes( filter.field ) ) {
visibleFilters.push( filter.field );
}
} );
onChangeView( {
...view,
filters: fromTanStackColumnFilters( columnFiltersUpdater() ),
visibleFilters,
filters,
page: 1,
} );
},
Expand Down

0 comments on commit c5f597b

Please sign in to comment.