-
Notifications
You must be signed in to change notification settings - Fork 530
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
Pagination widget showNext and showLast disable problem #1938
Labels
Comments
Hi @EZarkov, that's a good catch. Thanks :)
|
vvo
pushed a commit
that referenced
this issue
Feb 6, 2017
<a name="3.0.0"></a> # [3.0.0](v2.2.5...v3.0.0) (2017-02-06) ### Bug Fixes * ***List:** disable shortcuts in *List SearchBoxes (#1921) ([51a76ae](51a76ae)), closes [#1920](#1920) * **Configure:** add configure parameters in search state (#1935) ([0971330](0971330)), closes [#1863](#1863) * **Hits:** limit the hitComponent to be only a function (#1912) ([b3c9578](b3c9578)) * **Pagination:** fix and indicate when pagination is disabled ([5f20199](5f20199)), closes [#1938](#1938) * **StarRating:** usage with filters (#1933) ([667e9d5](667e9d5)) * **withSearchBox:** keep displaying searchBox when no items found (#1930) ([30de4cd](30de4cd)) ### Features * **MultiRange:** indicate if a range has no refinements (#1926) ([80b6450](80b6450)) * **panel:** add a panel widget (#1889) ([594e1a1](594e1a1)) * **starRating:** indicate when any refinement has no effect ([c547ae5](c547ae5)) * **widgets:** default design for disabled states (#1929) ([31f010b](31f010b))
@chriscalip Can you open a new issue about it? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you want to request a feature or report a bug?
bug
Bug: What is the current behavior?
In Pagination widget
showNext
andshowLast
are not disabled when number of hits is 0Bug: What is the expected behavior?
To be disabled.
Bug: What browsers are impacted? Which versions?
Feature: What is your use case for such a feature?
Feature: What is your proposed API entry? The new option to add? What is the behavior?
Calculation for total pages:
https://github.com/algolia/instantsearch.js/blob/v2.2.5/packages/react-instantsearch/src/components/Pagination.js#L110
totalPages = 0
because number of hits is 0 ->https://github.com/algolia/instantsearch.js/blob/v2.2.5/packages/react-instantsearch/src/connectors/connectPagination.js#L48
https://github.com/algolia/instantsearch.js/blob/v2.2.5/packages/react-instantsearch/src/components/Pagination.js#L110https://github.com/algolia/instantsearch.js/blob/v2.2.5/packages/react-instantsearch/src/components/Pagination.js#L111
lastPage = 0
https://github.com/algolia/instantsearch.js/blob/v2.2.5/packages/react-instantsearch/src/connectors/connectPagination.js#L11
in searchState there is no key = page ->
https://github.com/algolia/instantsearch.js/blob/v2.2.5/packages/react-instantsearch/src/connectors/connectPagination.js#L49
currentRefinement = 1
https://github.com/algolia/instantsearch.js/blob/v2.2.5/packages/react-instantsearch/src/components/Pagination.js#L153
https://github.com/algolia/instantsearch.js/blob/v2.2.5/packages/react-instantsearch/src/components/Pagination.js#L163
disabled = false
Possible solution:
disabled: currentRefinement === lastPage || lastPage <= 1
What project are you opening an issue for?
What is the version you are using? Always use the latest one before opening a bug issue.
2.2.5
The text was updated successfully, but these errors were encountered: