Skip to content

Commit

Permalink
view.filters: remove undefined values
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Oct 17, 2023
1 parent 14b2ab8 commit 4bd0987
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/edit-site/src/components/dataviews/in-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ import {
__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,
SelectControl,
} from '@wordpress/components';
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';

/**
* Internal dependencies
*/
import { unlock } from '../../lock-unlock';

const { cleanEmptyObject } = unlock( blockEditorPrivateApis );

export default ( { id, fields, view, onChangeView } ) => {
const field = fields.find( ( f ) => f.id === id );
Expand All @@ -28,10 +36,10 @@ export default ( { id, fields, view, onChangeView } ) => {

onChangeView( ( currentView ) => ( {
...currentView,
filters: {
filters: cleanEmptyObject( {
...currentView.filters,
[ id ]: value,
},
} ),
} ) );
} }
/>
Expand Down

0 comments on commit 4bd0987

Please sign in to comment.