Skip to content

@sentry/vue: unmount/destroy lifecycle hooks do not work on vue 3 #9565

@snoozbuster

Description

@snoozbuster

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/vue

SDK Version

7.79.0

Framework Version

7.79.0

Link to Sentry event

No response

SDK Setup

import { App } from 'vue';
import * as Sentry from '@sentry/vue';

function installSentry(Vue: App) {
 Sentry.init({
    Vue,
    attachProps: true,
    logErrors: true,
    tracingOptions: {
      hooks: ['destroy', 'mount', 'update'],
      trackComponents: true,
    },
    // ... other stuff, not relevant
  });
}

Steps to Reproduce

  1. Configure the Vue integration with 'destroy' in the hooks.

Expected Result

  1. No warnings are logged when @vue/compat is installed.
  2. Destroy span tracking works on Vue 3 when @vue/compat is not installed

Actual Result

Observe that no spans are created for unmounting.

Bonus:

If @vue/compat is installed to provide Vue 2.x support to a Vue 3.x runtime and the OPTIONS_BEFORE_DESTROY and OPTIONS_DESTROYED flags are turned on, the spans are probably created, but these warnings are logged on every single component (assuming Sentry is initialized in a context where vue warnings are enabled):

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: vueIssues related to the Sentry Vue SDK

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions