question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RFC: InfiniteHits should load previous pages

See original GitHub issue

When reloading a page with urlSync and page > 0, the infinite hits doesn’t load the previous hence it doesn’t reproduce the exact same state. We decided to close https://github.com/algolia/instantsearch.js/issues/2750 but we’ve had other users asking for it.

Proposed API

const widget = instantsearch.widgets.infiniteHits({ 
  container: string|HTMLElement, 
  templates: [InfiniteHitsTemplates], 
  showMoreLabel: [string], 
  transformData: [InfiniteHitsTransforms], 
  cssClasses: [InfiniteHitsCSSClasses], 
  escapeHits: [boolean],
+  loadPreviousPagesOnReload: [boolean=false]
}: InfiniteHitsWidgetOptions);

Behaviour

The widget is not aware of the nature of the rendering. Therefore it should check at each rendering if the current page matches the cache of results. If it doesn’t it should reload the missing pages. Cool side effect of that, is that it could handle the changes of hits per page.

Raise your voice 😉

Because we might have a lot of pages, we should probably add anchors, and go directly to the current page?

The name is long but explicit 🤔

Please comment if you see a better name or you see any other issue.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bobylitocommented, Mar 27, 2018

Met with @sashaprok and she helped us define the problem and a plan

There is not one problem but 2:

  • When the user go to a product page and go back to the search
  • When you share your URL

Based on that we have two proposals:

  • when the browser loads the URL, load n page of previous results before the current page and display a button on top to be able to go back on the first page “There are xxx products, see all of them” (you load page 7 and you display 2 pages before, the button resets to page 0)
  • when the browser loads the URL, load n page of previous results before the current page and display a button on top to load also the page before (you load a link with page 7 and you only display 1 page before, the button let the user load page 5)
  • the two above loading 0 page of previous results

Next steps:

  • build PoC’s
  • user testing
  • pick one
0reactions
sashaprokcommented, Mar 27, 2018

We’re going to test both and see what works best.

On Tue, Mar 27, 2018 at 4:53 PM, Marie-Laure Thuret < notifications@github.com> wrote:

For the second proposal, does that mean that if you’re use case 1 (product page then go back), your navigator will put you at a place that will not be the one you were on previously (because the previous results are not displayed?)

Not sure to get this: the two above without loading previous pages at all

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/algolia/instantsearch.js/issues/2835#issuecomment-376555221, or mute the thread https://github.com/notifications/unsubscribe-auth/AjYq-PSAPtC01j8NVM9i4PhfFRvu6qFTks5tilJtgaJpZM4S8ehc .

https://www.algolia.com/

Alexandra (Sasha) Prokhorova

Product Designer

07 69 75 89 79 <07+69+75+89+79> https://www.linkedin.com/in/alexandraprokhorova

https://www.algolia.com/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Infinitehits show-previous: when loading page=x, load all ...
We are using the infinitehits widget, and have enabled the “show-previous” modifier to enable the “page=x” query parameter, which allows us ...
Read more >
instantsearch.js - UNPKG
n * This object should probably not be instantiated outside of the helper. ... n * This option allows you to avoid doing...
Read more >
Untitled
Gare harry potter poudlard, Melanie safka peace will come tekst, ... Yonover chicago, Bannockburn rfc pitchero, Aion beritra's phantom wings.
Read more >
react-instantsearch-dom @ 5.4.0 .. 5.6.0 - Package Diff
dist/cjs/components/InfiniteHits.js ... + loadPrevious: 'Load previous', ... The ScrollTo component will make the page scroll to the component wrapped by it ...
Read more >
Full text of "Your Sinclair Magazine Issue 18" - Internet Archive
Thit m«ani thot not only will you § al tw*htf* worm and froofly [BSUAi of 1^ ... otwl yog'f« Ksvifig loading probbmj, lh#re...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found