Skip to content

React InstantSearch multi-index setup triggers excessive duplicate requests causing Algolia errors #6795

@ramonvheerde-rgb

Description

@ramonvheerde-rgb

🐛 Current behavior

When using React InstantSearch with a multi-index setup where <Index> components are rendered dynamically, the library appears to generate multiple redundant requests per index whenever filters are applied.

As the number of sections (indexes) increases, these requests multiply rapidly — ultimately leading to Algolia API errors once the total number of subqueries exceeds the allowed request size. See; https://support.algolia.com/hc/en-us/articles/10159122160529-Why-am-I-getting-too-many-queries-in-multi-queries-request-error

🔍 Steps to reproduce

  1. Create a React InstantSearch app using multiple dynamically rendered components.
    Each represents a section of the UI (e.g. category, collection, or content type).

  2. Add a (or any other facet-based widget) on the root index.

  3. Select multiple (different facet) filters.

  4. Observe the network requests in your browser’s DevTools.

When filters are applied, React InstantSearch generates multiple batched subqueries per index.
Each index seems to receive a combination of queries — some to retrieve hits, others to fetch facet data — even though only one facet widget exists in the tree.

Example payload:

  {
    "indexName": "instant_search",
    "facetFilters": [["brand:Apple"]],
    "facets": ["*"]
  },
  {
    "indexName": "instant_search",
    "analytics": false,
    "facets": "brand",
    "hitsPerPage": 0
  },
  {
    "indexName": "instant_search",
    "facetFilters": [["brand:Apple"]],
    "filters": "categories:\"TV & Home Theater\""
  },
  {
    "indexName": "instant_search",
    "analytics": false,
    "facets": "brand",
    "hitsPerPage": 0
  }
]

As the number of <Index> components and active filters grows, the number of requests increases linearly or worse.
Eventually, Algolia responds with an error due to too many subqueries in a single multi-query request.

Live reproduction

https://codesandbox.io/p/github/ramonvheerde-rgb/algolia-multi-request-bug/draft/black-paper

💭 Expected behavior

Each <Index> should only trigger the necessary query for its own hits, and React InstantSearch should avoid sending duplicate or facet-only subqueries to Algolia when filters change, because these are not relevant.

We amount of request should not grow when we apply filters or add multiple <Index> components

Package version

"react-instantsearch": "^7.13.9"

Operating system

macOS 26.0.1

Browser

Chromium Engine Version 142.0.7444.60

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageIssues to be categorized by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions