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.

transform-items called multiple times

See original GitHub issue

Bug 🐞

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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Haroenvcommented, Jul 31, 2019

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)

0reactions
Haroenvcommented, Dec 21, 2022

This will not change any further, transformItems gets called as many times as needed to render

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hits widget transformItems is called twice, receives already ...
It appears that the transformItems function of the hits widget is being called twice for a single search invocation, and is receiving the ......
Read more >
hits | InstantSearch.js
To configure the number of hits to show, use the hitsPerPage widget or the ... transformItems(items) { return items.map(item => ({ ...item, name:...
Read more >
React InstantSearch RefinementList transformItems not ...
The transformItems function has one parameter: items . It expects in return to have it back. items is an array of objects with...
Read more >
How can I select and transform items from a list in ...
PS > $sumList | Group Bool -NoElement | select Name, Count Name Count ---- ----- false 1 true 3. So, the full modified...
Read more >
problem with proportionally transform items with illustrator 21
For example , when i try to resize a circle 3 X 3 to 2cm height, the object will be deformed ( 1.7...
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