Skip to content
This repository was archived by the owner on Dec 30, 2022. It is now read-only.

Displaying some sort of placeholder instead of hiding component when there are no facets #347

Closed
riasvdv opened this issue Oct 23, 2017 · 4 comments · Fixed by #670
Closed

Comments

@riasvdv
Copy link

riasvdv commented Oct 23, 2017

Do you want to request a feature or report a bug?

Feature

Feature: What is your use case for such a feature?

When a component has no facets or results then they get hidden, but in my current implementation this makes it look like the interface broke, see screenshots for an example:

With results (ok)
image

Without results (looks broken)
image

I can't see any way to still display something when there are no results.

Feature: What is your proposed API entry? The new option to add? What is the behavior?

Add a placeholder slot or something comparable to still show some sort of message or button when the component would be hidden.

What is the version you are using? Always use the latest one before opening a bug issue.

Latest

@rayrutjes
Copy link
Member

Interesting feedback @Rias500 , WDYT @ronanlevesque ?

@michaelpumo
Copy link

Just chiming in, but I think this term is known as “ghosts”. Essentially showing facet links that would result in zero results.

I think it’d be nice to have this, especially from a UX perspective as it can help the user have a better understanding with what’s going on.

There is a plugin for WordPress that produces Facet searching and it had this option. See example doc here:
https://facetwp.com/documentation/checkboxes/

@batFormat
Copy link

batFormat commented Dec 25, 2018

@Haroenv Can you please tell me if such a function is planned in v2?

@Haroenv
Copy link
Contributor

Haroenv commented Dec 28, 2018

In v2 you can do this, but only when you are making fully custom components (using createWidgetMixin). This is probably something we should make achievable using the panel.

Haroenv added a commit that referenced this issue Apr 30, 2019
This allows you to create interface like:

```vue
<ais-panel>
  <template slot="header">Hi</template>
  <template slot="default" slot-scope="{ noRefinement }">
    <p v-if="noRefinement">no results</p>
    <ais-refinement-list attribute="brand" />
  </template>
</ais-panel>
```

sandbox with this: https://codesandbox.io/s/znw7ry52wl (which now obviously doesn't work).

fixes #347
Haroenv added a commit that referenced this issue Apr 30, 2019
* feat(panel): provide noRefinement scope to slots

This allows you to create interface like:

```vue
<ais-panel>
  <template slot="header">Hi</template>
  <template slot="default" slot-scope="{ noRefinement }">
    <p v-if="noRefinement">no results</p>
    <ais-refinement-list attribute="brand" />
  </template>
</ais-panel>
```

sandbox with this: https://codesandbox.io/s/znw7ry52wl (which now obviously doesn't work).

fixes #347

* fix: correct syntax

* fix(panel): correct conditional around slots

* chore(panel): rename to hasRefinements
Haroenv added a commit to algolia/instantsearch that referenced this issue Dec 28, 2022
…tsearch#670)

* feat(panel): provide noRefinement scope to slots

This allows you to create interface like:

```vue
<ais-panel>
  <template slot="header">Hi</template>
  <template slot="default" slot-scope="{ noRefinement }">
    <p v-if="noRefinement">no results</p>
    <ais-refinement-list attribute="brand" />
  </template>
</ais-panel>
```

sandbox with this: https://codesandbox.io/s/znw7ry52wl (which now obviously doesn't work).

fixes algolia/vue-instantsearch#347

* fix: correct syntax

* fix(panel): correct conditional around slots

* chore(panel): rename to hasRefinements
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants