From 613b034e743f92112b9dd8c8a99581c30f528852 Mon Sep 17 00:00:00 2001 From: Mark Florian Date: Thu, 6 Mar 2025 12:03:50 +0000 Subject: [PATCH] chore(Vue3): Remove slot check workaround With our upgrade to @vue/compat@3.5.13 in https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/4900, which includes the fix for https://github.com/vuejs/core/issues/8869 (https://github.com/vuejs/core/pull/10868) we no longer need this workaround. --- src/utils/is_slot_empty.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/utils/is_slot_empty.js b/src/utils/is_slot_empty.js index b852c499a3..abe7eb26c4 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); -- GitLab