From ea7ba2254fe829d180a43b61be6329d54ad00aa1 Mon Sep 17 00:00:00 2001 From: Onur Temizkan Date: Fri, 4 Oct 2024 12:18:21 +0300 Subject: [PATCH] Provide an option for adding breadcrumbs --- packages/vue/src/pinia.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/vue/src/pinia.ts b/packages/vue/src/pinia.ts index 2f272267f810..d9106b3463d0 100644 --- a/packages/vue/src/pinia.ts +++ b/packages/vue/src/pinia.ts @@ -12,6 +12,7 @@ type PiniaPlugin = (context: { type SentryPiniaPluginOptions = { attachPiniaState?: boolean; + addBreadcrumbs?: boolean; actionTransformer?: (action: any) => any; stateTransformer?: (state: any) => any; }; @@ -48,10 +49,14 @@ export const createSentryPiniaPlugin: (options?: SentryPiniaPluginOptions) => Pi store.$onAction(context => { context.after(() => { const transformedActionName = options.actionTransformer - ? options.actionTransformer(context.name) || '' + ? options.actionTransformer(context.name) : context.name; - if (typeof transformedActionName !== 'undefined' && transformedActionName !== null) { + if ( + typeof transformedActionName !== 'undefined' && + transformedActionName !== null && + options.addBreadcrumbs !== false + ) { addBreadcrumb({ category: 'action', message: transformedActionName,