File tree Expand file tree Collapse file tree 1 file changed +10
-17
lines changed Expand file tree Collapse file tree 1 file changed +10
-17
lines changed Original file line number Diff line number Diff line change @@ -89,22 +89,13 @@ export const firestorePlugin = function firestorePlugin(
8989 ) {
9090 const options = Object . assign ( { } , globalOptions , userOptions )
9191 const target = toRef ( this . $data as any , key )
92- let unbinds = firestoreUnbinds . get ( this )
93-
94- if ( unbinds ) {
95- if ( unbinds [ key ] ) {
96- unbinds [ key ] (
97- // if wait, allow overriding with a function or reset, otherwise, force reset to false
98- // else pass the reset option
99- options . wait
100- ? typeof options . reset === 'function'
101- ? options . reset
102- : false
103- : options . reset
104- )
105- }
106- } else {
107- firestoreUnbinds . set ( this , ( unbinds = { } ) )
92+ if ( ! firestoreUnbinds . has ( this ) ) {
93+ firestoreUnbinds . set ( this , { } )
94+ }
95+ const unbinds = firestoreUnbinds . get ( this ) !
96+
97+ if ( unbinds [ key ] ) {
98+ unbinds [ key ] ( options . reset )
10899 }
109100
110101 const { promise, unbind } = _useFirestoreRef ( docOrCollectionRef , {
@@ -113,7 +104,9 @@ export const firestorePlugin = function firestorePlugin(
113104 } )
114105 unbinds [ key ] = unbind
115106 // @ts -expect-error: we are allowed to write it
116- this . $firestoreRefs [ key ] = docOrCollectionRef
107+ this . $firestoreRefs [ key ] =
108+ // ts
109+ docOrCollectionRef
117110 return promise . value
118111 }
119112
You can’t perform that action at this time.
0 commit comments