File tree Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Expand file tree Collapse file tree 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) {
3737 authUid,
3838 config : { userProfile, useFirestoreForProfile }
3939 } = 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 )
5252 }
53+ firebase . _ . profileWatch = null
5354}
5455
5556/**
You can’t perform that action at this time.
0 commit comments