typesense / typesense-instantsearch-adapter

A JS adapter library to build rich search interfaces with Typesense and InstantSearch.js
MIT License
414 stars 64 forks source link

Holding backspace does not remove first character in refinementList search field #28

Open polkabrothers opened 3 years ago

polkabrothers commented 3 years ago

Description

When using a searchable refinementList and using search inside the facet widget to filter results, the first character is not cleared if holding backspace, removing characters one at a time works though.

Example from: https://recipe-search.typesense.org/ ts_facet

Steps to reproduce

Go to https://recipe-search.typesense.org/ Search for something Type something in the filter ingredients facet search Hold backspace to remove facet search string completely

jasonbosco commented 3 years ago

@polkabrothers Did you notice this issue in your app, or did you only see it on the recipe search site? If it's the latter, it's actually a side-effect of how I've implemented the search on that site. It's on my todo list to fix, but it's not directly related to this adapter.

unclescooby commented 3 years ago

Possibly related: doing this in the main search input will not remove the first character in the url query string

polkabrothers commented 3 years ago

@jasonbosco This happens in my app as well.

diegodeluca commented 2 years ago

There are any news about this issue?

jasonbosco commented 2 years ago

I took a look at this, but I don't think is related to the typesense instantsearch adapter. This seems like an issue in instantsearch itself. For eg, if you press backspace and delete one character at a time then this issue doesn't happen. So this suggests to me that there is some race condition in the event handler inside instantsearch where it fires off multiple parallel calls and then uses whatever call returns last (even if its out of order) to render the UI state, when instead it should probably serialize the requests, or cancel a request that's in-flight before initiating a new search request from this widget.

diegodeluca commented 2 years ago

I've tried with any example at this page: https://typesense.org/docs/overview/demos.html and even deleting one letter at time or using only one letter the issue persists.

The issue isn't present on the example in typesense homepage https://typesense.org/

jasonbosco commented 2 years ago

Hmm, here's a screengrab showing the issue happening initially when I hold down the backspace key, and then not happening when I delete one character at a time:

https://user-images.githubusercontent.com/458383/152605080-dae928d1-8598-4800-bcad-899a9d05d590.mov

Or at least this is what I understood of the issue. Is this the same issue you're experiencing as well?

diegodeluca commented 2 years ago

I was referring about the main search box, where you searched "pizza"

jasonbosco commented 2 years ago

Hmm, that's potentially a different issue then. Could you open a separate Github issue describing the exact issue you're seeing?

This issue was originally only related to searching within the search box in the refinementList.