Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Why is onSuggestSelect fired when there's no user input? #373

Open
tstirrat15 opened this issue Jan 3, 2018 · 5 comments
Open

Comments

@tstirrat15
Copy link

My project uses react-geosuggest for a search bar, and we've been seeing a bunch of sentry errors where our onSuggestSelect function is expecting to find a property on the suggestion passed to the function but does not find it. It seemed weird that this error is being thrown at all.

I figured out that I can replicate the error by:

  1. Let the page load
  2. Enter some text into the searchbar
  3. Delete that text
  4. Click out of the searchbar

This code is the source of the issue. I'd call it a bug except that it seems to have been coded this way intentionally - why was that?

I could pretty easily wrap my onSuggestSelect function with a check to make sure that the suggestion exists, but that seems like a hack.

@oyeanuj
Copy link
Contributor

oyeanuj commented Mar 6, 2018

@ro-ka Also came here to report this bug. The way I see it show up so much more often is you backspace or delete your typed query, you'll notice the call to onSuggestSelect with no suggestion being passed. This is also reproducible in the demo.

@tstirrat15 Thanks for creating this issue!

@danawhite
Copy link

I've recently encountered the same issue. @oyeanuj @tstirrat15 have you been able to resolve this issue?

@tstirrat15
Copy link
Author

@danawhite by checking that the desired properties are present in the suggestion in the callback for onSuggestSelect. It's hackish but it works..

@oyeanuj
Copy link
Contributor

oyeanuj commented Mar 22, 2018

@danawhite Same as @tstirrat15 but hoping this can be fixed.

@ro-ka
Copy link
Contributor

ro-ka commented May 22, 2018

The code was introduced with PR #350. We need to make sure to keep the intended behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants