Skip to content

Commit

Permalink
make sure groupContext is not undefined or null
Browse files Browse the repository at this point in the history
On vercel, getting a strange issue like `TypeError: undefined is not an
object (evaluating 'r.resolveTarget')` which doesn't happen locally or
once published. Would expect it to be `null` since we default to `null`.
Hopefully this fixes things.
  • Loading branch information
RobinMalfait committed Mar 15, 2022
1 parent 75a3f84 commit c1d5312
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/@headlessui-vue/src/components/portal/portal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ export let Portal = defineComponent({
let myTarget = ref(
forcePortalRoot === true
? getPortalRoot(element.value)
: groupContext === null
: groupContext == null
? getPortalRoot(element.value)
: groupContext.resolveTarget()
)

watchEffect(() => {
if (forcePortalRoot) return
if (groupContext === null) return
if (groupContext == null) return
myTarget.value = groupContext.resolveTarget()
})

Expand Down

0 comments on commit c1d5312

Please sign in to comment.