From e27cc5aef93410f7b988eb22dc8af556fdfd69c8 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 2 Dec 2024 13:26:33 +0000 Subject: [PATCH] fix(nuxt): tidy up remnants of previous `useId` implementation --- docs/3.api/2.composables/use-id.md | 42 ------------------------- packages/nuxt/src/app/composables/id.ts | 1 + packages/nuxt/src/app/nuxt.ts | 5 --- 3 files changed, 1 insertion(+), 47 deletions(-) delete mode 100644 docs/3.api/2.composables/use-id.md diff --git a/docs/3.api/2.composables/use-id.md b/docs/3.api/2.composables/use-id.md deleted file mode 100644 index 6a29535f88..0000000000 --- a/docs/3.api/2.composables/use-id.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: "useId" -description: Generate an SSR-friendly unique identifier that can be passed to accessibility attributes. -links: - - label: Source - icon: i-simple-icons-github - to: https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/app/composables/id.ts - size: xs ---- - -::important -This composable is available since [Nuxt v3.10](/blog/v3-10#ssr-safe-accessible-unique-id-creation). -:: - -`useId` generates an SSR-friendly unique identifier that can be passed to accessibility attributes. - -Call `useId` at the top level of your component to generate a unique string identifier: - -```vue [components/EmailField.vue] - - - -``` - -::note -`useId` must be used in a component with a single root element, as it uses this root element's attributes to pass the id from server to client. -:: - -## Parameters - -`useId` does not take any parameters. - -## Returns - -`useId` returns a unique string associated with this particular `useId` call in this particular component. diff --git a/packages/nuxt/src/app/composables/id.ts b/packages/nuxt/src/app/composables/id.ts index 7b3fdd6076..ab10e79d94 100644 --- a/packages/nuxt/src/app/composables/id.ts +++ b/packages/nuxt/src/app/composables/id.ts @@ -1,3 +1,4 @@ import { useId as _useId } from 'vue' +/** @deprecated Use `useId` from `vue` */ export const useId = _useId diff --git a/packages/nuxt/src/app/nuxt.ts b/packages/nuxt/src/app/nuxt.ts index 4faff0a1bc..f4d0efd3f5 100644 --- a/packages/nuxt/src/app/nuxt.ts +++ b/packages/nuxt/src/app/nuxt.ts @@ -114,11 +114,6 @@ interface _NuxtApp { * The id of the Nuxt application. * @internal */ _id: string - /** - * The next id that can be used for generating unique ids via `useId`. - * @internal - */ - _genId?: number /** @internal */ _scope: EffectScope /** @internal */