Skip to content

Commit

Permalink
Remove stuff related to Default queries from view.js
Browse files Browse the repository at this point in the history
  • Loading branch information
michalczaplinski committed Nov 26, 2024
1 parent dac2ec1 commit 91863c0
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions packages/block-library/src/search/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,26 +109,15 @@ const { state, actions } = store(
const url = new URL( window.location.href );

if ( value ) {
if ( ctx.isInherited ) {
url.searchParams.set( 'instant-search', value );

// Make sure we reset the pagination.
url.searchParams.set( 'paged', '1' );
} else {
// Set the instant-search parameter using the query ID and search value
const queryId = ctx.queryId;
url.searchParams.set(
`instant-search-${ queryId }`,
value
);
// Set the instant-search parameter using the query ID and search value
const queryId = ctx.queryId;
url.searchParams.set(
`instant-search-${ queryId }`,
value
);

// Make sure we reset the pagination.
url.searchParams.set( `query-${ queryId }-page`, '1' );
}
} else if ( ctx.isInherited ) {
// Reset global search for inherited queries
url.searchParams.delete( 'instant-search' );
url.searchParams.delete( 'paged' );
// Make sure we reset the pagination.
url.searchParams.set( `query-${ queryId }-page`, '1' );
} else {
// Reset specific search for non-inherited queries
url.searchParams.delete(
Expand Down

0 comments on commit 91863c0

Please sign in to comment.