Skip to content

Commit

Permalink
feat(vue): Support Vue 3 lifecycle hooks in mixin options (#9578)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
snoozbuster authored Nov 20, 2023
1 parent ff416ae commit 6f4edf8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/vue/src/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ interface VueSentry extends ViewModel {
const HOOKS: { [key in Operation]: Hook[] } = {
activate: ['activated', 'deactivated'],
create: ['beforeCreate', 'created'],
// Vue 3
unmount: ['beforeUnmount', 'unmounted'],
// Vue 2
destroy: ['beforeDestroy', 'destroyed'],
mount: ['beforeMount', 'mounted'],
update: ['beforeUpdate', 'updated'],
Expand Down
4 changes: 3 additions & 1 deletion packages/vue/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ export type Hook =
| 'activated'
| 'beforeCreate'
| 'beforeDestroy'
| 'beforeUnmount'
| 'beforeMount'
| 'beforeUpdate'
| 'created'
| 'deactivated'
| 'destroyed'
| 'unmounted'
| 'mounted'
| 'updated';

export type Operation = 'activate' | 'create' | 'destroy' | 'mount' | 'update';
export type Operation = 'activate' | 'create' | 'destroy' | 'mount' | 'update' | 'unmount';

0 comments on commit 6f4edf8

Please sign in to comment.