Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions packages/vue/src/pinia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,20 @@ export const createSentryPiniaPlugin: (options?: SentryPiniaPluginOptions) => Pi
const timestamp = new Date().toTimeString().split(' ')[0];
const filename = `pinia_state_all_stores_${timestamp}.json`;

hint.attachments = [
...(hint.attachments || []),
{
filename,
data: JSON.stringify(getAllStoreStates()),
},
];
// event processor runs for each pinia store - attachment should only be added once per event
const hasExistingPiniaStateAttachment = hint.attachments?.some(attachment =>
attachment.filename.startsWith('pinia_state_all_stores_'),
);

if (!hasExistingPiniaStateAttachment) {
hint.attachments = [
...(hint.attachments || []),
{
filename,
data: JSON.stringify(getAllStoreStates()),
},
];
}
} catch (_) {
// empty
}
Expand Down
Loading