sickdyd / react-search-autocomplete

A search box that filters the provided array of objects
https://sickdyd.github.io/react-search-autocomplete
MIT License
222 stars 85 forks source link

Multiple warnings on react component #121

Closed notleanbarba closed 5 months ago

notleanbarba commented 5 months ago

Describe the bug When sending the form, console logs multiple warning regarding tag on search bar.

Codesandbox example https://codesandbox.io/p/sandbox/busy-hooks-9kfmct

To Reproduce Steps to reproduce the behavior:

  1. Enter "John" in search box
  2. Select any result
  3. See error in console and window

Expected behavior No React warnings is expected

Screenshots image

Additional context using "react": ">=16.0.0"

YusufCelik commented 5 months ago

I have the same issue! I cannot for the life of me understand why this suddenly happened. As the OG reports, it happens when you just select a result!

YusufCelik commented 5 months ago

Ok, I found the issue.

@notleanbarba, you need to have a name prop.


fuseOptions={{
    keys: [
      "customer_name",
      "hot_tub_id",
      "technician_name", // -> name
      "servicetime",
    ],
}}

 In my case it was changing resultStringKeyName...
notleanbarba commented 5 months ago

That works. Good catch!

Edit:

Error strings (For google search)

Possible improvement This issue report should be enough to document the warning. However, a try-catch could be added to handle this.