transform-items called multiple times
See original GitHub issueBug 🐞
What is the current behavior?
transform-items
called multiple times on ais-infinite-hits
. For each ais-refinement-list
component there will be another extra call made. In my case it’s 12 calls, which makes the website glitchy.
Make a sandbox with the current behavior
https://codesandbox.io/s/vue-instantsearch-v2-starter-f7o8b?fontsize=14
What is the expected behavior?
call transoform-items
only once, after new hits are added.
When the items are transformed vue refreshes item-template. In my case it’s masonry layout with quite large images. So transform-items is too expensive to be called multiple times.
Does this happen only in specific situations?
When changing filters (please click on a product title in sandbox to change optional filter brand name). Console will log when transform-items is called.
What is the proposed solution?
Call transform-items only once, when the hits are added.
What is the version you are using?
vue-instantsearch ^2.3.0 (updated today)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top GitHub Comments
The multiple identical queries can be fixed by adding
algoliasearch(xxx, xxx, { _useRequestCache: true })
, but I still don’t see how in that UI you are rerendering the page (any rerender will cause a request, maybe identical as an existing one if it hasn’t finished yet)This will not change any further, transformItems gets called as many times as needed to render