Skip to content

Commit

Permalink
fix search invalidates the views
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Aug 2, 2024
1 parent a3ac1cc commit 8be7349
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/dataviews/src/components/dataviews-search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ const DataViewsSearch = memo( function Search( { label }: SearchProps ) {
viewRef.current = view;
}, [ onChangeView, view ] );
useEffect( () => {
onChangeViewRef.current( {
...viewRef.current,
page: 1,
search: debouncedSearch,
} );
if ( debouncedSearch !== viewRef.current?.search ) {
onChangeViewRef.current( {
...viewRef.current,
page: 1,
search: debouncedSearch,
} );
}
}, [ debouncedSearch ] );
const searchLabel = label || __( 'Search' );
return (
Expand Down

0 comments on commit 8be7349

Please sign in to comment.