Skip to content

Commit e1b2964

Browse files
GwynervaNataliaTepluhina
authored andcommitted
Error Capturing Caveats (#3141)
* Update options-lifecycle.md Error capturing caveats. See [issue](vuejs/core#12575 (comment)). * Update src/api/options-lifecycle.md --------- Co-authored-by: Natalia Tepluhina <[email protected]>
1 parent 0d7a8a4 commit e1b2964

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/api/options-lifecycle.md

+6
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,12 @@ Appelé lorsqu'une erreur venant d'un composant descendant a été capturée.
215215

216216
- Un hook `errorCaptured` peut retourner `false` pour empêcher l'erreur de se propager plus loin. Cela revient à dire "cette erreur a été traitée et doit être ignorée". Cela empêchera tout autre hook `errorCaptured` ou `app.config.errorHandler` d'être invoqué pour cette erreur.
217217

218+
**Error Capturing Caveats**
219+
220+
- 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.
221+
222+
- <sup class="vt-badge" data-text="SSR only"></sup> Replacing errored child component in parent component deep inside `<Suspense>` 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.
223+
218224
## renderTracked <sup class="vt-badge dev-only" /> {#rendertracked}
219225

220226
Appelé lorsqu'une dépendance réactive a été traquée par l'effet de rendu du composant.

0 commit comments

Comments
 (0)