Skip to content

Svelecte 5 with fetch prop displays, "No data related to your search," even when response contains data #263

@michaelyoon

Description

@michaelyoon

I have an API route that is definitely returning data (specifically, an array of strings), but Svelecte just displays, "No data related to your search".

I added a fetchCallback prop to log the data returned from the server:

<Svelecte fetch="/api/autocomplete?q=[query]" minQuery={3}
   fetchCallback={(data: any) => {
    console.log(data);
    return data;
  }}
  bind:value={$formData.value}
/>

I can see the data in the browser's JS console, which, for now, is just an array of strings: ["Alpha", "Beta", "Gamma"]

I imagine that I'm doing something wrong, but can't figure out what it is. Any suggestions on how to debug this would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions