Skip to content

Commit

Permalink
Merge pull request #195 from algolia/fix_pagination
Browse files Browse the repository at this point in the history
Preserve page from IS URL
  • Loading branch information
Jan Petr authored Apr 3, 2017
2 parents 47626c8 + 19bff53 commit f8344b0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion view/frontend/web/instantsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ requirejs(['algoliaBundle'], function(algoliaBundle) {
return {};
},
init: function (data) {
var page = data.helper.state.page;

if (algoliaConfig.request.refinementKey.length > 0) {
data.helper.toggleRefine(algoliaConfig.request.refinementKey, algoliaConfig.request.refinementValue);
}
Expand All @@ -89,6 +91,8 @@ requirejs(['algoliaBundle'], function(algoliaBundle) {
else {
data.helper.addNumericRefinement('visibility_search', '=', 1);
}

data.helper.setPage(page);
},
render: function (data) {
if (!algoliaConfig.isSearchPage) {
Expand Down Expand Up @@ -406,7 +410,9 @@ requirejs(['algoliaBundle'], function(algoliaBundle) {
search.start();

if (algoliaConfig.request.path.length > 0 && algoliaConfig.areCategoriesInFacets === true) {
search.helper.toggleRefine('categories.level0', algoliaConfig.request.path).search();
var page = data.helper.state.page;

search.helper.toggleRefinement('categories.level0', algoliaConfig.request.path).setPage(page).search();
}

handleInputCrossInstant($(instant_selector));
Expand Down

0 comments on commit f8344b0

Please sign in to comment.