Skip to content

Commit

Permalink
Fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
thecrypticace committed Aug 28, 2023
1 parent 6444e01 commit 4b0ab1e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/@headlessui-vue/src/components/portal/portal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
PropType,
Ref,
watch,
getCurrentInstance,
} from 'vue'
import { render } from '../../utils/render'
import { usePortalRoot } from '../../internal/portal-force-root'
Expand Down Expand Up @@ -81,12 +82,13 @@ export let Portal = defineComponent({
// We use `watch` on `element` + a local var rather than
// `onMounted` to ensure registration only happens once
let didRegister = false
let instance = getCurrentInstance()
watch(element, () => {
if (didRegister) return
if (!parent) return
let domElement = dom(element)
if (!domElement) return
onUnmounted(parent.register(domElement))
onUnmounted(parent.register(domElement), instance)
didRegister = true
})

Expand Down

2 comments on commit 4b0ab1e

@vercel
Copy link

@vercel vercel bot commented on 4b0ab1e Aug 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

headlessui-vue – ./packages/playground-vue

headlessui-vue.vercel.app
headlessui-vue-tailwindlabs.vercel.app
headlessui-vue-git-main-tailwindlabs.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 4b0ab1e Aug 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

headlessui-react – ./packages/playground-react

headlessui-react-tailwindlabs.vercel.app
headlessui-react.vercel.app
headlessui-react-git-main-tailwindlabs.vercel.app

Please sign in to comment.