File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 11import { getCurrentHub , initAndBind , Integrations as CoreIntegrations , SDK_VERSION } from '@sentry/core' ;
2- import { getGlobalObject , SyncPromise } from '@sentry/utils' ;
2+ import { addInstrumentationHandler , getGlobalObject , SyncPromise } from '@sentry/utils' ;
33
44import { BrowserOptions } from './backend' ;
55import { BrowserClient } from './client' ;
@@ -249,4 +249,19 @@ function startSessionTracking(): void {
249249 fcpResolved = true ;
250250 possiblyEndSession ( ) ;
251251 }
252+
253+ // We want to create a session for every navigation as well
254+ addInstrumentationHandler ( {
255+ callback : ( ) => {
256+ if (
257+ ! getCurrentHub ( )
258+ . getScope ( )
259+ ?. getSession ( )
260+ ) {
261+ hub . startSession ( ) ;
262+ hub . endSession ( ) ;
263+ }
264+ } ,
265+ type : 'history' ,
266+ } ) ;
252267}
You can’t perform that action at this time.
0 commit comments