Skip to content

Commit 613b034

Browse files
committed
chore(Vue3): Remove slot check workaround
With our upgrade to @vue/[email protected] in https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/4900, which includes the fix for vuejs/core#8869 (vuejs/core#10868) we no longer need this workaround.
1 parent 5992792 commit 613b034

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/utils/is_slot_empty.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
import Vue from 'vue';
2-
import { isVue3 } from './constants';
32

43
// Fragment will be available only in Vue.js 3
54
const { Fragment, Comment, Text } = Vue;
65

7-
function callIfNeeded(fnOrResult, args) {
8-
return fnOrResult instanceof Function ? fnOrResult(args) : fnOrResult;
9-
}
10-
116
export function isVnodeEmpty(vnode) {
127
if (!vnode || (Comment && vnode.type === Comment)) {
138
return true;
@@ -33,11 +28,7 @@ export function isVnodeEmpty(vnode) {
3328
}
3429

3530
export function isSlotEmpty(vueInstance, slot, slotArgs) {
36-
const slotContent = isVue3
37-
? // we need to check both $slots and $scopedSlots due to https://github.com/vuejs/core/issues/8869
38-
// additionally, in @vue/compat $slot might be a function instead of array of vnodes (sigh)
39-
callIfNeeded(vueInstance.$slots[slot] || vueInstance.$scopedSlots[slot], slotArgs)
40-
: vueInstance.$scopedSlots[slot]?.(slotArgs);
31+
const slotContent = vueInstance.$scopedSlots[slot]?.(slotArgs);
4132

4233
// eslint-disable-next-line unicorn/no-array-callback-reference
4334
return isVnodeEmpty(slotContent);

0 commit comments

Comments
 (0)