Skip to content

Commit

Permalink
Update options-lifecycle.md
Browse files Browse the repository at this point in the history
Error capturing caveats. See [issue](vuejs/core#12575 (comment)).
  • Loading branch information
Gwynerva authored Jan 8, 2025
1 parent 48e2de2 commit 8b40df3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/api/options-lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ Called when an error propagating from a descendant component has been captured.

- An `errorCaptured` hook can return `false` to prevent the error from propagating further. This is essentially saying "this error has been handled and should be ignored." It will prevent any additional `errorCaptured` hooks or `app.config.errorHandler` from being invoked for this error.

**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!

- <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.

## renderTracked <sup class="vt-badge dev-only" /> {#rendertracked}

Called when a reactive dependency has been tracked by the component's render effect.
Expand Down

0 comments on commit 8b40df3

Please sign in to comment.