File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { addNonEnumerableProperty } from '@sentry/utils';
4
4
// Inline PiniaPlugin type
5
5
type PiniaPlugin = ( context : {
6
6
store : {
7
+ $id : string ;
7
8
$state : unknown ;
8
9
$onAction : ( callback : ( context : { name : string ; after : ( callback : ( ) => void ) => void } ) => void ) => void ;
9
10
} ;
@@ -26,10 +27,14 @@ export const createSentryPiniaPlugin: (options?: SentryPiniaPluginOptions) => Pi
26
27
options . attachPiniaState &&
27
28
getGlobalScope ( ) . addEventProcessor ( ( event , hint ) => {
28
29
try {
30
+ // Get current timestamp in hh:mm:ss
31
+ const timestamp = new Date ( ) . toTimeString ( ) . split ( ' ' ) [ 0 ] ;
32
+ const filename = `pinia_state_${ store . $id } _${ timestamp } .json` ;
33
+
29
34
hint . attachments = [
30
35
...( hint . attachments || [ ] ) ,
31
36
{
32
- filename : 'pinia_state.json' ,
37
+ filename,
33
38
data : JSON . stringify ( store . $state ) ,
34
39
} ,
35
40
] ;
You can’t perform that action at this time.
0 commit comments