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

<b-table> empty scoped slot renders unwanted default value #3919

Closed
Hiws opened this issue Aug 20, 2019 · 2 comments · Fixed by #3920 · May be fixed by thislooksfun/earthdawn#37

Comments

@Hiws
Copy link

commented Aug 20, 2019

Describe the bug

If you have a scoped slot with conditional content, for example only showing something if an array has elements.
If the slot is completely empty it will render out the default value, which in this case would be [] which might not be wanted.

Steps to reproduce the bug

  1. Create a table with a scoped slot.
  2. Leave the slot empty or add a v-if
  3. If the v-if is not met and the slot is empty it will display the default content.

Expected behavior

If the v-if is not be and the scoped slot is empty, it should not render anything.

Versions

Libraries:

  • BootstrapVue: 2.0.0-rc.28
  • Bootstrap: 4.3.1
  • Vue: 2.x.x

Demo link

https://codepen.io/Hiws/pen/jONrbGX

tmorehouse added a commit that referenced this issue Aug 20, 2019
fix(b-table, b-table-lite): handle edge case where field slot returns…
… no vNodes (fixes #3919)


Fixes an edge case where user conditionally renders content inside a scoped slot, which was causing the cell to be rendered with the raw value when it shouldn't.

Fixes #3919
@tmorehouse

This comment has been minimized.

Copy link
Member

commented Aug 20, 2019

Workaround: use a v-else to render a &nbsp;

Fix will be available in 2.0.0 stable.

Note that the data cell scoped slot names will be changing in 2.0.0 stable, due to issues and limitations with Vue's new v-slot syntax. vuejs/rfcs#2 (comment)

@tmorehouse tmorehouse added this to In Progress in 2.0.0 Stable Aug 20, 2019

2.0.0 Stable automation moved this from In Progress to Completed Aug 20, 2019

tmorehouse added a commit that referenced this issue Aug 20, 2019
@tmorehouse

This comment has been minimized.

Copy link
Member

commented Sep 7, 2019

BootstrapVue v2.0.0 stable has been released. See https://bootstrap-vue.js.org/docs/misc/changelog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
2 participants
You can’t perform that action at this time.