File tree Expand file tree Collapse file tree 1 file changed +20
-18
lines changed Expand file tree Collapse file tree 1 file changed +20
-18
lines changed Original file line number Diff line number Diff line change @@ -189,23 +189,25 @@ function startSessionTracking(): void {
189
189
190
190
const hub = getCurrentHub ( ) ;
191
191
192
- if ( 'startSession' in hub ) {
193
- // The only way for this to be false is for there to be a version mismatch between @sentry /browser (>= 6.0.0) and
194
- // @sentry /hub (< 5.27.0). In the simple case, there won't ever be such a mismatch, because the two packages are
195
- // pinned at the same version in package.json, but there are edge cases where it's possible'. See
196
- // https://github.com/getsentry/sentry-javascript/issues/3234 and
197
- // https://github.com/getsentry/sentry-javascript/issues/3207.
198
-
199
- hub . startSession ( ) ;
200
- hub . captureSession ( ) ;
201
-
202
- // We want to create a session for every navigation as well
203
- addInstrumentationHandler ( {
204
- callback : ( ) => {
205
- hub . startSession ( ) ;
206
- hub . captureSession ( ) ;
207
- } ,
208
- type : 'history' ,
209
- } ) ;
192
+ // The only way for this to be false is for there to be a version mismatch between @sentry /browser (>= 6.0.0) and
193
+ // @sentry /hub (< 5.27.0). In the simple case, there won't ever be such a mismatch, because the two packages are
194
+ // pinned at the same version in package.json, but there are edge cases where it's possible. See
195
+ // https://github.com/getsentry/sentry-javascript/issues/3207 and
196
+ // https://github.com/getsentry/sentry-javascript/issues/3234 and
197
+ // https://github.com/getsentry/sentry-javascript/issues/3278.
198
+ if ( typeof hub . startSession !== 'function' || typeof hub . captureSession !== 'function' ) {
199
+ return ;
210
200
}
201
+
202
+ hub . startSession ( ) ;
203
+ hub . captureSession ( ) ;
204
+
205
+ // We want to create a session for every navigation as well
206
+ addInstrumentationHandler ( {
207
+ callback : ( ) => {
208
+ hub . startSession ( ) ;
209
+ hub . captureSession ( ) ;
210
+ } ,
211
+ type : 'history' ,
212
+ } ) ;
211
213
}
You can’t perform that action at this time.
0 commit comments