Skip to content

Commit 6f4edf8

Browse files
authored
feat(vue): Support Vue 3 lifecycle hooks in mixin options (#9578)
Adds support for the `unmount` hook added in Vue 3. The `destroy` hook no longer works in Vue 2. See PR and issue for more details.
1 parent ff416ae commit 6f4edf8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/vue/src/tracing.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ interface VueSentry extends ViewModel {
2323
const HOOKS: { [key in Operation]: Hook[] } = {
2424
activate: ['activated', 'deactivated'],
2525
create: ['beforeCreate', 'created'],
26+
// Vue 3
27+
unmount: ['beforeUnmount', 'unmounted'],
28+
// Vue 2
2629
destroy: ['beforeDestroy', 'destroyed'],
2730
mount: ['beforeMount', 'mounted'],
2831
update: ['beforeUpdate', 'updated'],

packages/vue/src/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,14 @@ export type Hook =
7676
| 'activated'
7777
| 'beforeCreate'
7878
| 'beforeDestroy'
79+
| 'beforeUnmount'
7980
| 'beforeMount'
8081
| 'beforeUpdate'
8182
| 'created'
8283
| 'deactivated'
8384
| 'destroyed'
85+
| 'unmounted'
8486
| 'mounted'
8587
| 'updated';
8688

87-
export type Operation = 'activate' | 'create' | 'destroy' | 'mount' | 'update';
89+
export type Operation = 'activate' | 'create' | 'destroy' | 'mount' | 'update' | 'unmount';

0 commit comments

Comments
 (0)