algolia / algolia/docsearch

Initializing Docsearch more than once creates multiple overlapping autocomplete drop downs

Open
#927 4 comments 2 reactions 0 assignees View on GitHub
DocSearch v3
Dominant language
TypeScript
Stars
4.4k
Forks
439
Avg merge
14h 32m
Merged PRs (30d)
19

Description

**Do you want to request a _feature_ or report a _bug_?**
Feature

**What is the current behavior?**
When calling `window.docsearch({...options})` multiple times, multiple autocomplete dropdowns are added to the UI.

**If the current behavior is a bug, please provide all the steps to reproduce and a minimal
[JSFiddle][3] example or a repository on GitHub that we can `npm install`
and `npm start`.**

**What is the expected behavior?**
I need to be able to apply filters to the search based on user selection. I'm not sure if this is currently possible. I have tried to call `window.docsearch({...options})` when the user picks a category to search by, but that seems to add multiple autocomplete dropdowns instead of refreshing the current instance. It would be nice if you could refresh the autocomplete dropdown with results from a newly filtered index.

Contributor guide

Open the contributing guide

Research direction

Start at the public window.docsearch({...options}) entry point and reproduce the problem by invoking it repeatedly after a category selection. Trace how the autocomplete dropdown and filtered index are managed; done means reusing or refreshing the current instance so one dropdown reflects the selected filter.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.