File tree 1 file changed +13
-12
lines changed
1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -37,19 +37,20 @@ export function unWatchUserProfile(firebase) {
37
37
authUid,
38
38
config : { userProfile, useFirestoreForProfile }
39
39
} = firebase . _
40
- if ( firebase . _ . profileWatch ) {
41
- if ( useFirestoreForProfile && firebase . firestore ) {
42
- // Call profile onSnapshot unsubscribe stored on profileWatch
43
- firebase . _ . profileWatch ( )
44
- } else {
45
- firebase
46
- . database ( )
47
- . ref ( )
48
- . child ( ` ${ userProfile } / ${ authUid } ` )
49
- . off ( 'value' , firebase . _ . profileWatch )
50
- }
51
- firebase . _ . profileWatch = null
40
+ if ( ! firebase . _ . profileWatch ) {
41
+ return
42
+ }
43
+ if ( useFirestoreForProfile && firebase . firestore ) {
44
+ // Call profile onSnapshot unsubscribe stored on profileWatch
45
+ firebase . _ . profileWatch ( )
46
+ } else if ( userProfile && firebase . database ) {
47
+ firebase
48
+ . database ( )
49
+ . ref ( )
50
+ . child ( ` ${ userProfile } / ${ authUid } ` )
51
+ . off ( 'value' , firebase . _ . profileWatch )
52
52
}
53
+ firebase . _ . profileWatch = null
53
54
}
54
55
55
56
/**
You can’t perform that action at this time.
0 commit comments