Skip to content

Commit 516cbfb

Browse files
committed
docs: refine useId warning with computed
1 parent 275c2cd commit 516cbfb

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/api/composition-api-helpers.md

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@ This is the underlying helper that powers [`defineModel()`](/api/sfc-script-setu
4242
set?: (v: T) => any
4343
}
4444
45-
type ModelRef<T, M extends PropertyKey = string, G = T, S = T> = Ref<
46-
G,
47-
S
48-
> &
49-
[ModelRef<T, M, G, S>, Record<M, true | undefined>]
45+
type ModelRef<T, M extends PropertyKey = string, G = T, S = T> = Ref<G, S> & [
46+
ModelRef<T, M, G, S>,
47+
Record<M, true | undefined>
48+
]
5049
```
5150

5251
- **Example**
@@ -136,15 +135,4 @@ Used to generate unique-per-application IDs for accessibility attributes or form
136135

137136
:::warning Caution
138137
`useId()` should be not be called inside a `computed()` property as it may cause instance conflicts. Instead, declare the ID outside of `computed()` and reference it within the computed function.
139-
140-
```vue
141-
<script setup>
142-
import { computed, useId } from 'vue'
143-
144-
const id = useId()
145-
146-
const ariaDescribedBy = computed(() => `${id}-description`)
147-
</script>
148-
```
149-
150138
:::

0 commit comments

Comments
 (0)