diff --git a/src/utils/is_slot_empty.js b/src/utils/is_slot_empty.js index b852c499a358baa0a860b85e54abf321648194ec..abe7eb26c4db0c0faaee9b88ac6d84575ad5f3c2 100644 --- a/src/utils/is_slot_empty.js +++ b/src/utils/is_slot_empty.js @@ -1,13 +1,8 @@ import Vue from 'vue'; -import { isVue3 } from './constants'; // Fragment will be available only in Vue.js 3 const { Fragment, Comment, Text } = Vue; -function callIfNeeded(fnOrResult, args) { - return fnOrResult instanceof Function ? fnOrResult(args) : fnOrResult; -} - export function isVnodeEmpty(vnode) { if (!vnode || (Comment && vnode.type === Comment)) { return true; @@ -33,11 +28,7 @@ export function isVnodeEmpty(vnode) { } export function isSlotEmpty(vueInstance, slot, slotArgs) { - const slotContent = isVue3 - ? // we need to check both $slots and $scopedSlots due to https://github.com/vuejs/core/issues/8869 - // additionally, in @vue/compat $slot might be a function instead of array of vnodes (sigh) - callIfNeeded(vueInstance.$slots[slot] || vueInstance.$scopedSlots[slot], slotArgs) - : vueInstance.$scopedSlots[slot]?.(slotArgs); + const slotContent = vueInstance.$scopedSlots[slot]?.(slotArgs); // eslint-disable-next-line unicorn/no-array-callback-reference return isVnodeEmpty(slotContent);