Skip to content

Commit

Permalink
DataViews: fix typing in combobox filter (WordPress#60819)
Browse files Browse the repository at this point in the history
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
Co-authored-by: oandregal <oandregal@git.wordpress.org>
  • Loading branch information
3 people authored Apr 17, 2024
1 parent b10be5b commit a6e8b68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/dataviews/src/search-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function normalizeSearchInput( input = '' ) {
return removeAccents( input.trim().toLowerCase() );
}

const EMPTY_ARRAY = [];
const getCurrentValue = ( filterDefinition, currentFilter ) => {
if ( filterDefinition.singleSelection ) {
return currentFilter?.value;
Expand All @@ -52,7 +53,7 @@ const getCurrentValue = ( filterDefinition, currentFilter ) => {
return [ currentFilter.value ];
}

return [];
return EMPTY_ARRAY;
};

const getNewValue = ( filterDefinition, currentFilter, value ) => {
Expand Down Expand Up @@ -198,7 +199,7 @@ function ComboboxList( { view, filter, onChangeView } ) {
}, [ filter.elements, deferredSearchValue ] );
return (
<Ariakit.ComboboxProvider
value={ searchValue }
resetValueOnSelect={ false }
selectedValue={ currentValue }
setSelectedValue={ ( value ) => {
const newFilters = currentFilter
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-site/src/components/page-pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export default function PagePages() {
} = useEntityRecords( 'postType', postType, queryArgs );

const { records: authors, isResolving: isLoadingAuthors } =
useEntityRecords( 'root', 'user' );
useEntityRecords( 'root', 'user', { per_page: -1 } );

const paginationInfo = useMemo(
() => ( {
Expand Down

0 comments on commit a6e8b68

Please sign in to comment.