fix(core/vue): Detect and skip normalizing Vue VNode objects with high normalizeDepth #18206
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Fixes #18203
Problem
When using
normalizeDepth: 10withcaptureConsoleIntegrationenabled, Vue VNodes in console arguments would trigger recursive warning spam. Accessing VNode properties during normalization would trigger Vue's reactive getters, which emit console warnings. These warnings would then be captured and normalized again, creating a recursive loop that could generate hundreds of warnings.Note that this only happens in
devmodeSolution
Changed
isVueViewModel()to detect Vue 3 VNodes (__v_isVNode: true) in addition to Vue 2/3 ViewModels. VNodes are now identified early in the normalization process and stringified as[VueVNode]before their properties are accessed, preventing the recursive warning loop.Some of the properties on the
VNodecan also be reactive, so it can incorrectly add those to a watchEffect or a render function reactive dependencies when accessed by the normalizer.Changes
packages/core/src/utils/is.ts: Added__v_isVNodecheck toisVueViewModel().packages/core/src/utils/normalize.ts: Distinguish VNodes from ViewModels in output ([VueVNode]vs[VueViewModel]).I couldn't reproduce this exactly in a test with a real vue component, but verified it fixes the reproduction example.
The before and after of the captured logs:
Before:
After:
As a Vue developer I don't think the loss of information here would help debug anything.