diff --git a/packages/core/src/utils/normalize.ts b/packages/core/src/utils/normalize.ts index 1c25d937cfe4..cf55a83dd7df 100644 --- a/packages/core/src/utils/normalize.ts +++ b/packages/core/src/utils/normalize.ts @@ -1,7 +1,7 @@ import type { Primitive } from '../types-hoist/misc'; -import { isSyntheticEvent, isVueViewModel } from './is'; +import { isSyntheticEvent } from './is'; import { convertToPlainObject } from './object'; -import { getFunctionName, getVueInternalName } from './stacktrace'; +import { getFunctionName } from './stacktrace'; type Prototype = { constructor?: (...args: unknown[]) => unknown }; // This is a hack to placate TS, relying on the fact that technically, arrays are objects with integer keys. Normally we @@ -216,8 +216,12 @@ function stringifyValue( return '[Document]'; } - if (isVueViewModel(value)) { - return getVueInternalName(value); + if ( + typeof value === 'object' && + value !== null && + ('__isVue' in value || '_isVue' in value || '__v_isVNode' in value) + ) { + return '__v_isVNode' in value && value.__v_isVNode ? '[VueVNode]' : '[VueViewModel]'; } // React's SyntheticEvent thingy diff --git a/packages/core/src/utils/string.ts b/packages/core/src/utils/string.ts index fe28ef24c46a..82a1417e2061 100644 --- a/packages/core/src/utils/string.ts +++ b/packages/core/src/utils/string.ts @@ -1,5 +1,4 @@ -import { isRegExp, isString, isVueViewModel } from './is'; -import { getVueInternalName } from './stacktrace'; +import { isRegExp, isString } from './is'; export { escapeStringForRegex } from '../vendor/escapeStringForRegex'; @@ -76,13 +75,14 @@ export function safeJoin(input: unknown[], delimiter?: string): string { for (let i = 0; i < input.length; i++) { const value = input[i]; try { - // This is a hack to fix a Vue3-specific bug that causes an infinite loop of - // console warnings. This happens when a Vue template is rendered with - // an undeclared variable, which we try to stringify, ultimately causing - // Vue to issue another warning which repeats indefinitely. + // Vue3 ViewModels and VNodes can cause infinite console warning loops when stringified // see: https://github.com/getsentry/sentry-javascript/pull/8981 - if (isVueViewModel(value)) { - output.push(getVueInternalName(value)); + if ( + typeof value === 'object' && + value !== null && + ('__isVue' in value || '_isVue' in value || '__v_isVNode' in value) + ) { + output.push('__v_isVNode' in value && value.__v_isVNode ? '[VueVNode]' : '[VueViewModel]'); } else { output.push(String(value)); }