Skip to content

Commit 90db17d

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 a00eda6 commit 90db17d

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 @@ Called when an error propagating from a descendant component has been captured.
215215

216216
- 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.
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
Called when a reactive dependency has been tracked by the component's render effect.

0 commit comments

Comments
 (0)