Skip to content

When empty list is returned by query, then "no results" is not handled properly. #25

@lauri911

Description

@lauri911

I'm submitting a ...

  • bug report
  • feature request
  • support request

What is the current behavior?

When empty list is returned by query, then "not found" is not handled properly.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

  1. open https://kazanexpress.github.io/vue-simple-suggest/
  2. type "adfasdfasdf"
  3. you will see a line appearing below input (empty dropdown is show).

What is the expected behavior?

One way to handle it:

Create a special slot "no-results" - then user can handle it (pass "query" to this slot as well)

At moment you have this layout:

  1. miscItemAbove
  2. suggestItems
    
  3. miscItemBelow

...and question is how to hande "no-results" layout.
I prefer this, because header and footer are usually about results, no-result is handled differently:
With results:

  1. miscItemAbove
  2. suggestItems
    
  3. miscItemBelow
    Without results:
  4. no-results slot

If "no-results" slot is not defined by user, then hide dropdown completly.
For example, for hidding dropdown use
computed:
hasNoResultsSlot () {
return !!this.$scopedSlots['no-results'];
}

PS. Please use same convention for slot names - camelCase or kebab-case, not mixed.
Its hard to remember, was it miscItem-above or miscItem-Above or miscItem-Above or misc-ItemAbove. (Maybe rename them: results-header and results-footer)

Metadata

Metadata

Labels

bugSomething isn't workingrefactoringCode smells, needs refactoring

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions