-
Notifications
You must be signed in to change notification settings - Fork 26
Remove query-{id}-page pagination parameter while searching #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| <?php return array('dependencies' => array('@wordpress/interactivity', array('id' => '@wordpress/interactivity-router', 'import' => 'dynamic')), 'version' => 'e7ba522c0e73d74a56f1', 'type' => 'module'); | ||
| <?php return array('dependencies' => array('@wordpress/interactivity', array('id' => '@wordpress/interactivity-router', 'import' => 'dynamic')), 'version' => '345fefaef4946b1f7924', 'type' => 'module'); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,16 @@ const updateURL = async ( action, value, name ) => { | |
| } else { | ||
| url.searchParams.delete( name ); | ||
| } | ||
|
|
||
| // Remove pagination when performing a search | ||
| // for your specific pagination format: query-{id}-page | ||
| const searchParams = url.searchParams; | ||
| [...searchParams.keys()].forEach(param => { | ||
| if (param.match(/query-\d+-page/) || param === 'paged') { | ||
| searchParams.delete(param); | ||
| } | ||
| }); | ||
|
Comment on lines
+11
to
+18
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it should be possible to scope this to the current query loop block as this will reset pagination for all query loops on the page, and they should be able to work independently. E.g. if |
||
|
|
||
| const { actions } = await import( '@wordpress/interactivity-router' ); | ||
| await actions.navigate( url.toString() ); | ||
| }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is appears to just be flipping the logic around and not actually changing anything, was it solving something specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@roborourke Yeah, not sure what that is :)
Looks like removing pagination while doing the search should happen in
view.js.