From efce04c08f5751b6ce77ebbb08101d74fea984e2 Mon Sep 17 00:00:00 2001 From: Peter Radko Date: Tue, 21 Jan 2025 12:01:48 +0300 Subject: [PATCH 1/3] Error Capturing Caveats (#3141) * Update options-lifecycle.md Error capturing caveats. See [issue](https://github.com/vuejs/core/issues/12575#issuecomment-2575368469). * Update src/api/options-lifecycle.md --------- Co-authored-by: Natalia Tepluhina --- src/api/options-lifecycle.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/api/options-lifecycle.md b/src/api/options-lifecycle.md index bdf7daad..a16c27ab 100644 --- a/src/api/options-lifecycle.md +++ b/src/api/options-lifecycle.md @@ -209,6 +209,12 @@ - يمكن لخطاف `()errorCaptured` أن يرجع `false` لمنع الخطأ من الانتشار أكثر. هذا يعني بشكل أساسي "تم التعامل مع هذا الخطأ ويجب تجاهله." سيمنع أي خطافات `()errorCaptured` إضافية أو `app.config.errorHandler` من الاستدعاء لهذا الخطأ. + **Error Capturing Caveats** + + - In components with async `setup()` function (with top-level `await`) Vue **will always** try to render component template, even if `setup()` throwed error. This will likely cause more errors because during render component's template might try to access non-existing properties of failed `setup()` context. When capturing errors in such components, be ready to handle errors from both failed async `setup()` (they will always come first) and failed render process. + + - Replacing errored child component in parent component deep inside `` will cause hydration mismatches in SSR. Instead, try to separate logic that can possibly throw from child `setup()` into separate function and execute it in the parent component's `setup()`, where you can safely `try/catch` the execution process and make replacement if needed before rendering the actual child component. + ## renderTracked {#rendertracked} يستدعى عندما يتم تتبع اعتمادية تفاعلية بواسطة تأثير تصيير المكون. From 2890c7c4d6c224dae504f219cff4bca966215ad8 Mon Sep 17 00:00:00 2001 From: Daria Savinova <95074135+dariasavinova@users.noreply.github.com> Date: Tue, 21 Jan 2025 15:56:59 +0700 Subject: [PATCH 2/3] docs: fix $el type in documentation to 'any' (#3139) --- src/api/component-instance.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/component-instance.md b/src/api/component-instance.md index cf9b7ef8..efb11c6e 100644 --- a/src/api/component-instance.md +++ b/src/api/component-instance.md @@ -42,7 +42,7 @@ ```ts interface ComponentPublicInstance { - $el: Node | undefined + $el: any } ``` From 705d8438235b0980887c297c982fed119b10f5b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=AA=20Quang=20=C4=90=C3=B4ng?= <38553985+lequangdongg@users.noreply.github.com> Date: Tue, 21 Jan 2025 15:55:52 +0700 Subject: [PATCH 3/3] docs: update template refs render function (#3126) * docs: update template refs render function * chore: remove sample * Update src/guide/extras/render-function.md resolved conversation Co-authored-by: Natalia Tepluhina --------- Co-authored-by: Natalia Tepluhina --- src/guide/extras/render-function.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/guide/extras/render-function.md b/src/guide/extras/render-function.md index 2467eb35..9b29065f 100644 --- a/src/guide/extras/render-function.md +++ b/src/guide/extras/render-function.md @@ -676,6 +676,21 @@ export default { } ``` +or (with version >= 3.5) + +```js +import { h, useTemplateRef } from 'vue' + +export default { + setup() { + const divEl = useTemplateRef('my-div') + + //
+ return () => h('div', { ref: 'my-div' }) + } +} +``` +