fix(components): hydration attribute mismatch with vue 3.4 (#1199)

This commit is contained in:
Benjamin Canac
2024-02-06 12:42:19 +01:00
committed by GitHub
parent 4a5f7b06cf
commit 10db14475f
19 changed files with 227 additions and 253 deletions

View File

@@ -29,13 +29,14 @@
<script lang="ts">
import { computed, toRef, defineComponent } from 'vue'
import type { PropType } from 'vue'
import { Dialog as HDialog, DialogPanel as HDialogPanel, TransitionRoot, TransitionChild } from '@headlessui/vue'
import { Dialog as HDialog, DialogPanel as HDialogPanel, TransitionRoot, TransitionChild, provideUseId } from '@headlessui/vue'
import { useUI } from '../../composables/useUI'
import { mergeConfig } from '../../utils'
import type { Strategy } from '../../types'
// @ts-expect-error
import appConfig from '#build/app.config'
import { modal } from '#ui/ui.config'
import { useId } from '#imports'
const config = mergeConfig<typeof modal>(appConfig.ui.strategy, appConfig.ui.modal, modal)
@@ -107,7 +108,7 @@ export default defineComponent({
function close (value: boolean) {
if (props.preventClose) {
emit('close-prevented')
return
}
@@ -116,6 +117,8 @@ export default defineComponent({
emit('close')
}
provideUseId(() => useId())
return {
// eslint-disable-next-line vue/no-dupe-keys
ui,

View File

@@ -38,7 +38,7 @@
import { computed, ref, toRef, onMounted, defineComponent, watch } from 'vue'
import type { PropType } from 'vue'
import { defu } from 'defu'
import { Popover as HPopover, PopoverButton as HPopoverButton, PopoverPanel as HPopoverPanel } from '@headlessui/vue'
import { Popover as HPopover, PopoverButton as HPopoverButton, PopoverPanel as HPopoverPanel, provideUseId } from '@headlessui/vue'
import { useUI } from '../../composables/useUI'
import { usePopper } from '../../composables/usePopper'
import { mergeConfig } from '../../utils'
@@ -46,6 +46,7 @@ import type { PopperOptions, Strategy } from '../../types'
// @ts-expect-error
import appConfig from '#build/app.config'
import { popover } from '#ui/ui.config'
import { useId } from '#imports'
const config = mergeConfig<typeof popover>(appConfig.ui.strategy, appConfig.ui.popover, popover)
@@ -210,6 +211,8 @@ export default defineComponent({
emit('update:open', newValue === 0)
})
provideUseId(() => useId())
return {
// eslint-disable-next-line vue/no-dupe-keys
ui,

View File

@@ -17,13 +17,14 @@
<script lang="ts">
import { computed, toRef, defineComponent } from 'vue'
import type { WritableComputedRef, PropType } from 'vue'
import { Dialog as HDialog, DialogPanel as HDialogPanel, TransitionRoot, TransitionChild } from '@headlessui/vue'
import { Dialog as HDialog, DialogPanel as HDialogPanel, TransitionRoot, TransitionChild, provideUseId } from '@headlessui/vue'
import { useUI } from '../../composables/useUI'
import { mergeConfig } from '../../utils'
import type { Strategy } from '../../types'
// @ts-expect-error
import appConfig from '#build/app.config'
import { slideover } from '#ui/ui.config'
import { useId } from '#imports'
const config = mergeConfig<typeof slideover>(appConfig.ui.strategy, appConfig.ui.slideover, slideover)
@@ -100,7 +101,7 @@ export default defineComponent({
function close (value: boolean) {
if (props.preventClose) {
emit('close-prevented')
return
}
@@ -108,6 +109,8 @@ export default defineComponent({
emit('close')
}
provideUseId(() => useId())
return {
// eslint-disable-next-line vue/no-dupe-keys
ui,