From 0f7a38b0f414a1f00cd50216f1d685682e8f3989 Mon Sep 17 00:00:00 2001 From: zernonia Date: Wed, 6 Mar 2024 17:13:04 +0800 Subject: [PATCH] chore: cleanup component --- packages/radix-vue/src/ConfigProvider/ConfigProvider.vue | 3 +++ packages/radix-vue/src/DropdownMenu/DropdownMenuTrigger.vue | 3 +-- packages/radix-vue/src/Popover/PopoverContent.vue | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/radix-vue/src/ConfigProvider/ConfigProvider.vue b/packages/radix-vue/src/ConfigProvider/ConfigProvider.vue index e4ba14801..e11ffbc09 100644 --- a/packages/radix-vue/src/ConfigProvider/ConfigProvider.vue +++ b/packages/radix-vue/src/ConfigProvider/ConfigProvider.vue @@ -23,6 +23,9 @@ export interface ConfigProviderProps { * @type boolean | ScrollBodyOption */ scrollBody?: boolean | ScrollBodyOption + /** + * The global `useId` injection as a workaround for preventing hydration issue. + */ useId?: () => string } diff --git a/packages/radix-vue/src/DropdownMenu/DropdownMenuTrigger.vue b/packages/radix-vue/src/DropdownMenu/DropdownMenuTrigger.vue index a2b15fca4..50f85234c 100644 --- a/packages/radix-vue/src/DropdownMenu/DropdownMenuTrigger.vue +++ b/packages/radix-vue/src/DropdownMenu/DropdownMenuTrigger.vue @@ -3,7 +3,6 @@ import type { PrimitiveProps } from '@/Primitive' import { useForwardExpose, useId } from '@/shared' export interface DropdownMenuTriggerProps extends PrimitiveProps { - id?: string /** When `true`, prevents the user from interacting with item */ disabled?: boolean } @@ -29,7 +28,7 @@ onMounted(() => { rootContext.triggerElement = triggerElement }) -rootContext.triggerId ||= useId(props.id, 'radix-vue-dropdown-menu-trigger') +rootContext.triggerId ||= useId(undefined, 'radix-vue-dropdown-menu-trigger')