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

Pagination widget showNext and showLast disable problem #1938

Closed
EZarkov opened this issue Feb 2, 2017 · 3 comments
Closed

Pagination widget showNext and showLast disable problem #1938

EZarkov opened this issue Feb 2, 2017 · 3 comments
Assignees

Comments

@EZarkov
Copy link

EZarkov commented Feb 2, 2017

Do you want to request a feature or report a bug?
bug
Bug: What is the current behavior?
In Pagination widget showNext and showLast are not disabled when number of hits is 0
Bug: 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?

  • react-instantsearch

What is the version you are using? Always use the latest one before opening a bug issue.
2.2.5

@mthuret
Copy link
Contributor

mthuret commented Feb 2, 2017

Hi @EZarkov, that's a good catch. Thanks :)

Classnames are updated correctly to reflect the disabled state but it misses the disabled attribute.

@mthuret mthuret self-assigned this Feb 3, 2017
@vvo vvo closed this as completed in 5f20199 Feb 6, 2017
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
Copy link
Contributor

chriscalip commented Feb 27, 2017

@vvo @mthuret
Sorry for ignorance but why is this feature fix not include in HEAD v1?
I would really like if this feature fixed be ported back to v1. :)

@vvo
Copy link
Contributor

vvo commented Feb 28, 2017

@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
Projects
None yet
Development

No branches or pull requests

4 participants