File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -45,13 +45,20 @@ export const createSentryPiniaPlugin: (options?: SentryPiniaPluginOptions) => Pi
4545 const timestamp = new Date ( ) . toTimeString ( ) . split ( ' ' ) [ 0 ] ;
4646 const filename = `pinia_state_all_stores_${ timestamp } .json` ;
4747
48- hint . attachments = [
49- ...( hint . attachments || [ ] ) ,
50- {
51- filename,
52- data : JSON . stringify ( getAllStoreStates ( ) ) ,
53- } ,
54- ] ;
48+ // event processor runs for each pinia store - attachment should only be added once per event
49+ const hasExistingPiniaStateAttachment = hint . attachments ?. some ( attachment =>
50+ attachment . filename . startsWith ( 'pinia_state_all_stores_' ) ,
51+ ) ;
52+
53+ if ( ! hasExistingPiniaStateAttachment ) {
54+ hint . attachments = [
55+ ...( hint . attachments || [ ] ) ,
56+ {
57+ filename,
58+ data : JSON . stringify ( getAllStoreStates ( ) ) ,
59+ } ,
60+ ] ;
61+ }
5562 } catch ( _ ) {
5663 // empty
5764 }
You can’t perform that action at this time.
0 commit comments