Won't Fix
Last Updated: 08 Sep 2022 15:34 by ADMIN
Created on: 01 Sep 2022 20:23
Category: Kendo UI® for Vue
Type: Bug Report
TabStrip in Vue cannot handle a comment or v-if node

Vue Version: 3.2.37

@progress/kendo-vue-layout version: 3.5.1

When using TabStrip in Vue 3 with the Composition API and `<script setup>`, there cannot be anything inside of the TabStrip other than visible markup. If there is an HTMLnode that's a comment, or is hidden using a `v-if,`, then that part of the page will not render and throw an error.

<TabStrip v-if="ctrOrSar !== 'Loading...'" :selected="selected" @select="onSelect">
    <TabStripTab title="Tab">
       Not a problem



    <TabStripTab v-if="false">
      big problem


<!-- <TabStripTab v-if="false" >
       Also a problem
    </TabStripTab> -->

This is the error received:
"`Uncaught (in promise) TypeError: children.forEach is not a function`" quoting a utils.js file line 4.

If my TabStripTabs have a v-if on them to not show if data isn't available for them, then the whole section of the page isn't useable.

Attached Files:
1 comment
Posted on: 08 Sep 2022 15:34

Hi, Chad. 

Thank you for the detailed description of the experienced issue. One or two releases away, we removed from our TabStrip demos the option to define the TabStrip tabs with a separate nested component. If you check the different examples, the tabs in the TabStrip are now defined using the tabs prop of the component. The TabStripTab component will be deprecated in a future breaking change release so we don't recommend its usage. 

Talking about the scenario that you want to implement, attached to my reply, you will find a runnable example that uses Composition API + Script setup that demonstrates how you can achieve the desired functionality. In the example we are passing the computedTabs computed property to the tabs prop of the TabStrip. The definition of the computedTabs property is as follows:

  const computedTabs = computed(() => {
    const tabToRemove = 'NewYork';
    return initialTabs.filter((tab) => tab.title !== tabToRemove);

The above snippet is a dummy example of how we can filter the value of the computedTabs property. What you can do in your scenario is to implement your custom logic that returns only the tabs that should be visible in each specific case. 

With the above said, I've changed the status of the current fug fix to "Won't Fix" as the TabStripTab component will soon be officially deprecated. 

Please let me know if you have questions about the suggested implementation or if you need further assistance with the implementation of your scenario. 

Looking forward to your reply.

Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Attached Files: