From 70851a05b0e7c305b908888a46fe52aae8ea8589 Mon Sep 17 00:00:00 2001 From: Craig Anderson Date: Sat, 20 Jan 2024 11:23:06 +0000 Subject: [PATCH] fix(vue-instantsearch): Ensure getDefaultSlots works with @vue/compat & Vue 3 --- .../src/util/vue-compat/index-vue3.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/vue-instantsearch/src/util/vue-compat/index-vue3.js b/packages/vue-instantsearch/src/util/vue-compat/index-vue3.js index dd3912d5cc..d2afcbe957 100644 --- a/packages/vue-instantsearch/src/util/vue-compat/index-vue3.js +++ b/packages/vue-instantsearch/src/util/vue-compat/index-vue3.js @@ -49,5 +49,13 @@ export function renderCompat(fn) { } export function getDefaultSlot(component) { - return component.$slots.default && component.$slots.default(); + const $slots = component.$slots || component.slots; + + if (typeof $slots.default === 'function') { + // Vue 3 + return $slots.default(); + } + + // Vue 3 with @vue/compat + return $slots.default; }