diff --git a/packages/block-library/src/query/edit/query-toolbar.js b/packages/block-library/src/query/edit/query-toolbar.js index db4de14f297b19..79e5b4f59d196c 100644 --- a/packages/block-library/src/query/edit/query-toolbar.js +++ b/packages/block-library/src/query/edit/query-toolbar.js @@ -61,11 +61,22 @@ export default function QueryToolbar( { labelPosition="edge" min={ 1 } max={ 100 } - onChange={ ( value ) => - setQuery( { - perPage: +value ?? -1, - } ) - } + onChange={ ( value ) => { + /** + * For now allow only a positive number and exclude `-1` + * which will result in fetching all entities. + */ + const numValue = +value; + if ( + numValue && + numValue >= 1 && + numValue <= 100 + ) { + setQuery( { + perPage: numValue, + } ); + } + } } step="1" value={ query.perPage } isDragEnabled={ false }