Skip to content
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

Query Pagination Previous: Add support for maximum page limit #67772

Conversation

yogeshbhutkar
Copy link
Contributor

@yogeshbhutkar yogeshbhutkar commented Dec 10, 2024

Fixes: #67748

What?

The Query Pagination Previous block is displayed even when a user navigates beyond the range of available query results. Since no results are shown in such cases, displaying this block is unnecessary and can be confusing. This PR addresses the issue by ensuring the Query Pagination Previous block is hidden when the query has no results, improving user experience and interface clarity.

How?

The logic has been updated to render the block only when the page number is greater than 1 and less than or equal to the total number of pages, ensuring accurate and appropriate visibility.

Testing Instructions

  1. Add a query loop block.
  2. Make sure to add Query Pagination block which contains Query Pagination Previous Block as well.
  3. Enter a page range that lies outside the query range.
  4. Observe that the block Query Pagination Previous is not rendered.

Screencast

Screen.Recording.2024-12-10.at.10.47.05.AM.mov

Screenshots

Before:
Screenshot 2024-12-10 at 11 42 10 AM

After:
Screenshot 2024-12-10 at 11 41 08 AM

@yogeshbhutkar yogeshbhutkar marked this pull request as ready for review December 10, 2024 06:12
Copy link

github-actions bot commented Dec 10, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @gutenbergplugin.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: gutenbergplugin.

Co-authored-by: yogeshbhutkar <[email protected]>
Co-authored-by: dknauss <[email protected]>
Co-authored-by: ramonjd <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: fabiankaegy <[email protected]>
Co-authored-by: ntsekouras <[email protected]>
Co-authored-by: matiasbenedetto <[email protected]>
Co-authored-by: tyxla <[email protected]>
Co-authored-by: mirka <[email protected]>
Co-authored-by: manzoorwanijk <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: mcsf <[email protected]>
Co-authored-by: jeryj <[email protected]>
Co-authored-by: jorgefilipecosta <[email protected]>
Co-authored-by: tellthemachines <[email protected]>
Co-authored-by: benazeer-ben <[email protected]>
Co-authored-by: akasunil <[email protected]>
Co-authored-by: louwie17 <[email protected]>
Co-authored-by: annezazu <[email protected]>
Co-authored-by: shail-mehta <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: Sukhendu2002 <[email protected]>
Co-authored-by: juanfra <[email protected]>
Co-authored-by: jsnajdr <[email protected]>
Co-authored-by: gziolo <[email protected]>
Co-authored-by: sarthaknagoshe2002 <[email protected]>
Co-authored-by: jameskoster <[email protected]>
Co-authored-by: alexflorisca <[email protected]>
Co-authored-by: afercia <[email protected]>
Co-authored-by: DAreRodz <[email protected]>
Co-authored-by: gigitux <[email protected]>
Co-authored-by: subodhr258 <[email protected]>
Co-authored-by: bph <[email protected]>
Co-authored-by: im3dabasia <[email protected]>
Co-authored-by: sirreal <[email protected]>
Co-authored-by: getdave <[email protected]>
Co-authored-by: stokesman <[email protected]>
Co-authored-by: PARTHVATALIYA <[email protected]>
Co-authored-by: Chrico <[email protected]>
Co-authored-by: draganescu <[email protected]>
Co-authored-by: ockham <[email protected]>
Co-authored-by: ciampo <[email protected]>
Co-authored-by: Mayank-Tripathi32 <[email protected]>
Co-authored-by: oandregal <[email protected]>
Co-authored-by: michalczaplinski <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@michalczaplinski michalczaplinski added [Type] Bug An existing feature does not function as intended [Block] Query Pagination Affects the Query Pagination Block - used for pagination within the Query Loop Block labels Dec 13, 2024
@michalczaplinski michalczaplinski self-requested a review December 13, 2024 20:06
Copy link
Contributor

@ntsekouras ntsekouras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Besides my small comment this looks good. Also, can you rebase the PR please?

$page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ];

$total_pages = $max_page;
if ( ! isset( $block->context['query']['inherit'] ) || ! $block->context['query']['inherit'] ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ntsekouras, Thanks for the review. I rebased the PR, and all the succeeding commits were pushed to it. That resulted in requesting reviews from many people. I don't think if that was expected out from this comment, so I've created a new PR here: #68070

I'll be proceeding to close this PR in contrast to the newly created PR.

dknauss and others added 18 commits December 18, 2024 10:14
Co-authored-by: dknauss <[email protected]>
Co-authored-by: oandregal <[email protected]>
In this view, ensure that the content is horizontally scrollable and the width takes up the screen.Co-authored-by: ramonjd <[email protected]>
Co-authored-by: ntsekouras <[email protected]>
Co-authored-by: megane9988 <[email protected]>
…efault via defaultControls config (WordPress#45994)

Co-authored-by: fabiankaegy <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: aaronrobertshaw <[email protected]>
Co-authored-by: jasmussen <[email protected]>
Co-authored-by: carolinan <[email protected]>
Co-authored-by: jeffpaul <[email protected]>
Co-authored-by: jordesign <[email protected]>
…Block (WordPress#67657)

Co-authored-by: fabiankaegy <[email protected]>
Co-authored-by: carolinan <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: ntsekouras <[email protected]>
…Press#67664)

Co-authored-by: ntsekouras <[email protected]>
Co-authored-by: oandregal <[email protected]>
Co-authored-by: ciampo <[email protected]>
Co-authored-by: doekenorg <[email protected]>
…cestor` (WordPress#48348)

Co-authored-by: ntsekouras <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: gziolo <[email protected]>
Co-authored-by: webmandesign <[email protected]>
* render overview colors in 4 columns

* use templateColums instead of colums to enable responsive columns

* use templateColumns instead of columns

* tweak CSS

Co-authored-by: matiasbenedetto <[email protected]>
Co-authored-by: tellthemachines <[email protected]>
Co-authored-by: jasmussen <[email protected]>
* Navigation: Fix active item hover color

* Add CHANGELOG entry

* Fix duplicate Enhancements sections

Co-authored-by: tyxla <[email protected]>
Co-authored-by: mirka <[email protected]>
* Components: Deprecate `COLORS.white`

* Add changelogs

* Update snapshot

Co-authored-by: mirka <[email protected]>
Co-authored-by: tyxla <[email protected]>
…67735)


Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: gziolo <[email protected]>
Co-authored-by: tyxla <[email protected]>
)

* TypeScript: Convert factory utils in data package to TS

* Fix docgen build error

* Update docs

* Revert and fix TS error

* Extract and improve signature
* wp-env: Add phpMyAdmin support

Defines two new docker-compose services: `phpmyadmin` and
`tests-phpmyadmin`. These are off by default. They can be individually
turned on by:

- Specifying a port in any enviroment's config via key `phpmyadminPort`
  (see bottom of commit message for example).
- By setting environment variable `WP_ENV_PHPMYADMIN_PORT` and/or
  `WP_ENV_TESTS_PHPMYADMIN_PORT`.

* Opt into the phpMyAdmin service in the Gutenberg environment

* wp-env: start: refactor computation of command output

- Refactor repeating logic into getPublicDockerPort
- Remove trailing newlines from dockerCompose output
- Refactor evaluation of spinner.prefixText so as to clearly reveal
  newlines.

{
  env: {
    development: {
      ...
      phpmyadminPort: 9000
    },
    tests: {
      ...
    }
  }
}

---------

Co-authored-by: Riad Benguella <[email protected]>
…ss#67707)

* Replace remaining custom deep cloning with 'structuredClone'
* Polyfill structuredClone for jsdom

Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: tyxla <[email protected]>
Co-authored-by: jsnajdr <[email protected]>
* Set default tab to 'blocks' if none passed
* Add tests for focusing blocks tab and closing inserter on keypresses
benazeer-ben and others added 2 commits December 18, 2024 10:15
* Add command to navigate to site editor

* No icon, improved label

* Modified code to display command other than Site editor

* Feedback and suggestion updates

---------

Co-authored-by: benazeer-ben <[email protected]>
Co-authored-by: richtabor <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: annezazu <[email protected]>
Co-authored-by: jameskoster <[email protected]>
Co-authored-by: jasmussen <[email protected]>
Co-authored-by: ramonjd <[email protected]>
…ress#67811)

* Give style book its own route so it can be linked to directly.

* Fix paths to and from global styles.

* Use query instead of path

* Fix path

* Effect for editor settings update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Query Pagination Affects the Query Pagination Block - used for pagination within the Query Loop Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query Pagination Previous block appears incorrectly when navigating to page outside of the query's range.