Skip to content

Commit ea7ba22

Browse files
committed
Provide an option for adding breadcrumbs
1 parent c7cfa72 commit ea7ba22

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/vue/src/pinia.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type PiniaPlugin = (context: {
1212

1313
type SentryPiniaPluginOptions = {
1414
attachPiniaState?: boolean;
15+
addBreadcrumbs?: boolean;
1516
actionTransformer?: (action: any) => any;
1617
stateTransformer?: (state: any) => any;
1718
};
@@ -48,10 +49,14 @@ export const createSentryPiniaPlugin: (options?: SentryPiniaPluginOptions) => Pi
4849
store.$onAction(context => {
4950
context.after(() => {
5051
const transformedActionName = options.actionTransformer
51-
? options.actionTransformer(context.name) || ''
52+
? options.actionTransformer(context.name)
5253
: context.name;
5354

54-
if (typeof transformedActionName !== 'undefined' && transformedActionName !== null) {
55+
if (
56+
typeof transformedActionName !== 'undefined' &&
57+
transformedActionName !== null &&
58+
options.addBreadcrumbs !== false
59+
) {
5560
addBreadcrumb({
5661
category: 'action',
5762
message: transformedActionName,

0 commit comments

Comments
 (0)