🐛 [rum-nuxt] Fix Nuxt post-hydration error handling#4899
Conversation
Bundles Sizes Evolution
|
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 9b5cc2e | Docs | Datadog PR Page | Give us feedback! |
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf131bfd1c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let shouldCallOriginal = true | ||
|
|
||
| nuxtApp.hook('app:suspense:resolve', () => { | ||
| if (isNuxtDefaultErrorHandler(original)) { |
There was a problem hiding this comment.
Support untagged Nuxt 3 default handlers
issue: This only disables delegation when Nuxt marks its default handler with __nuxt_default, but supported Nuxt 3 releases such as 3.11.2 install handleVueError without that marker and clear it after mount via an identity check instead (Nuxt 3.11.2 source). Because this wrapper has already replaced vueApp.config.errorHandler, Nuxt cannot clear its default handler, and this condition never flips shouldCallOriginal, so post-hydration client errors in those Nuxt 3 apps still delegate to Nuxt's default handler and render the full-page error.
Useful? React with 👍 / 👎.
bdibon
left a comment
There was a problem hiding this comment.
Good job! A couple of suggestions to improve tests readability.
Motivation
Issue.
Nuxt installs its default
vueApp.config.errorHandlerduring initial rendering and removes it after hydration onapp:suspense:resolve, as long as the handler was not overridden.The Nuxt RUM plugin wraps that handler before hydration, which prevents Nuxt’s identity check from removing it. As a result, client-side Vue errors triggered after hydration keep delegating to Nuxt’s default error handler and render the full-page error.vue, even though Nuxt would normally only log them to the console.
Changes
app:suspense:resolve.Test instructions
Trigger Error.?rum-config={"applicationId":"test","clientToken":"test","site":"datadoghq.com"}Trigger Error.Checklist