Skip to content

Commit 81d3626

Browse files
authored
docs: add addendum on useId usage with computed (#3262)
* docs: add addendum on useId usage with computed * docs: refine useId warning with computed
1 parent 328948b commit 81d3626

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/api/composition-api-helpers.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,7 @@ Used to generate unique-per-application IDs for accessibility attributes or form
132132
IDs generated by `useId()` are also guaranteed to be stable across the server and client renders, so they can be used in SSR applications without leading to hydration mismatches.
133133

134134
If you have more than one Vue application instance of the same page, you can avoid ID conflicts by giving each app an ID prefix via [`app.config.idPrefix`](/api/application#app-config-idprefix).
135+
136+
:::warning Caution
137+
`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.
138+
:::

0 commit comments

Comments
 (0)