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.

v2 - hierarchical facets added to state several times when using routing

See original GitHub issue

Bug 🐞

What is the current behavior?

When using an ais-refinement-list and ais-menu, while also having routing (using historyRouter and simpleMapping) enabled, the hierarchical facets are added multiple times to the search parameters.

A small CodeSandbox showing this behavior: https://codesandbox.io/s/9324rjjz3p Upon page load, using the browser’s network activity inspector, the request to Algolia servers shows that categories has been added to facets twice.

The bug is especially noticeable when working locally, as every time one changes something in a Vue file and a refresh happens, the duplicated hierarchical facets are duplicated again. Which, due to routing with state mapping being enabled, will result in the app hanging for several seconds or even crashing.

image image

This can best be reproduced by opening components/Facet.vue and adding a line break in the template, so a refresh happens.

What is the expected behavior?

The hierarchicalFacets should only be added once.

Does this happen only in specific situations?

When using ais-menu or ais-refinement-list together with routing enabled.

What is the proposed solution?

Unfortunately I haven’t figured out exactly where the bug is coming from.

What is the version you are using?

2.0.0-beta.1

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
samousscommented, Nov 22, 2018

Indeed the facet is added multiple times (2 times on the first render). But this should only happens with the hot reload. It should not happen in production because. The issue still persist on production but with a limited impact (it should not have more than 2 duplicates). The issue is not with Vue InstantSearch but with InstantSearch.js. Close in favor of https://github.com/algolia/instantsearch.js/issues/3278.

1reaction
dulnancommented, Nov 22, 2018

Thought about that too, yes. The custom connector in the component is doing a search to fetch all ~1000 items to show on the map. I’d have to do that in the v-show part to avoid the issue and put the actual map in the v-if part. I would also need to tell the connector to not fetch results when the map is not visible. So it would indeed be possible to avoid the issue!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hierarchical facets broken after updating to Facets 2.0.3 - Drupal
This means all hierarchical facets are broken. Steps to reproduce * Create a facet using facets 2.0.2 or earlier.
Read more >
Faceting | Algolia
Using hierarchical facets with many nested attributes creates many different facet names. This adds a lot of metadata that needs to be processed ......
Read more >
Multi-Faceted Hierarchical Multi-Task Learning for a Large ...
The multi-faceted and hierarchical design combined together introduces multidimensional implicit induction biases and results in a much more ef-.
Read more >
Hierarchical Navigation and Faceted Search on Top of Oracle ...
Deployment Schema and High-Level Architecture. The major architectural decision was to use in-memory data grid (IMDG) to shield the master RDBMS ...
Read more >
Apache Solr Reference Guide 8.0 - Faceting
You can set the facet.query parameter multiple times to indicate that multiple queries should be used as separate facet constraints. To use facet...
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