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

feat(infiniteHits): add previous button #3645

Merged
merged 33 commits into from Apr 10, 2019

Conversation

yannickcr
Copy link
Contributor

@yannickcr yannickcr commented Apr 2, 2019

Summary

The InfiniteHits widget is used to display a list of results with a “Show more” button. The user can click on this button to display more results without leaving its current page context.

Each time the user click on the “Show more” button the user will navigate to a new page (provided that the routing option is enabled in InstantSearch).

However, in the case the user navigates directly to a particular page (direct link, previous button, page refresh) then the widget only displays the last result page.

This change add a previous button to the Infinite Hits widget to give the possibility to the user to load the previous result pages.

For implementation details see the full RFC.

Before being mergeable, this change requires an update in https://github.com/algolia/instantsearch-specs to add the new CSS classes:

Result

A "with previous button enabled" story has been added for the Instant Hits widget.

https://deploy-preview-3645--instantsearchjs.netlify.com/stories/iframe.html?id=infinitehits--with-previous-button-enabled&page=3

fixes #2835

@algobot
Copy link
Contributor

algobot commented Apr 2, 2019

Deploy preview for instantsearchjs ready!

Built with commit d49a42c

https://deploy-preview-3645--instantsearchjs.netlify.com

@Haroenv
Copy link
Contributor

Haroenv commented Apr 2, 2019

It's pretty annoying that we chose to do the styling for each button individually, this way you need to update the style to see a correct styling here

Copy link
Member

@francoischalifour francoischalifour left a comment

Choose a reason for hiding this comment

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

The story isn't usable as is, we need to go to an iframe and to add query parameters. Is there a way to make the story available by default? Otherwise, we could add a link to the usable story to be able to play with the feature.

src/connectors/infinite-hits/connectInfiniteHits.js Outdated Show resolved Hide resolved
stories/infinite-hits.stories.js Outdated Show resolved Hide resolved
stories/infinite-hits.stories.js Outdated Show resolved Hide resolved
Copy link
Member

@francoischalifour francoischalifour left a comment

Choose a reason for hiding this comment

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

Only the mistake in the test is blocking, otherwise we're good to go!

src/components/InfiniteHits/InfiniteHits.js Show resolved Hide resolved
src/connectors/infinite-hits/connectInfiniteHits.js Outdated Show resolved Hide resolved
src/connectors/infinite-hits/connectInfiniteHits.js Outdated Show resolved Hide resolved
src/connectors/infinite-hits/connectInfiniteHits.js Outdated Show resolved Hide resolved
src/widgets/infinite-hits/__tests__/infinite-hits-test.js Outdated Show resolved Hide resolved
@yannickcr yannickcr merged commit 2c9e38d into develop Apr 10, 2019
@yannickcr yannickcr deleted the feat/infinitehits-previous-button branch April 10, 2019 11:06
@yannickcr yannickcr restored the feat/infinitehits-previous-button branch April 11, 2019 08:43
yannickcr added a commit that referenced this pull request Apr 11, 2019
francoischalifour added a commit that referenced this pull request Apr 11, 2019
# [3.3.0](v3.2.1...v3.3.0) (2019-04-11)

### Bug Fixes

* **connectQueryRules:** improve tracked refinement type ([#3648](#3648)) ([e16ad57](e16ad57))
* **currentRefinements:** don't rely on  ([#3672](#3672)) ([cd64bcf](cd64bcf))
* **queryRuleCustomData:** add default template ([#3650](#3650)) ([83e9eaa](83e9eaa))
* **QueryRuleCustomData:** pass data as object to templates ([#3647](#3647)) ([b8f8b4e](b8f8b4e))
* **queryRules:** fix types and stories ([#3670](#3670)) ([ba6e2e6](ba6e2e6))
* **routing:** apply windowTitle on first load ([#3669](#3669)) ([d553502](d553502)), closes [#3667](#3667)
* **routing:** support parsing URLs with up to 100 refinements ([#3671](#3671)) ([6ddcfb6](6ddcfb6))
* **RoutingManager:** avoid stale uiState ([#3630](#3630)) ([e1588aa](e1588aa))
* **types:** improve InstantSearch types ([#3651](#3651)) ([db9b91e](db9b91e))
* **ua:** Update the User-Agent to use the new format ([#3616](#3616)) ([ab84c57](ab84c57))

### Features

* **infiniteHits:** add previous button ([#3645](#3645)) ([2c9e38d](2c9e38d))
* **queryRules:** add connectQueryRules connector ([#3597](#3597)) ([924cd99](924cd99)), closes [#3599](#3599) [#3600](#3600)
* **queryRules:** add context features to Query Rules ([#3617](#3617)) ([922879e](922879e)), closes [#3602](#3602)

### Reverts

* feat(infiniteHits): add previous button ([214c0fc](214c0fc))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: InfiniteHits should load previous pages
5 participants