@@ -70,7 +70,7 @@ export function _useFirestoreRef(
7070 const data = options . target || ref < unknown | null > ( )
7171 // set the initial value from SSR even if the ref comes from outside
7272 data . value = getInitialValue ( initialSourceValue , options . ssrKey , data . value )
73- // TODO: allow passing pending and error refs as option for when this is called using the options api
73+
7474 const pending = ref ( true )
7575 const error = ref < FirestoreError > ( )
7676 // force the type since its value is set right after and undefined isn't possible
@@ -141,12 +141,11 @@ export function _useFirestoreRef(
141141 // create sync, you can read only once the whole thing so maybe we
142142 // should take an option like once: true to not setting up any listener
143143
144- // TODO: warn else
145144 if ( hasCurrentScope ) {
146145 onScopeDispose ( unbind )
147146 if ( getCurrentInstance ( ) ) {
148147 // wait for the promise during SSR
149- // TODO: configurable
148+ // TODO: configurable ssrKey: false to disable this
150149 onServerPrefetch ( ( ) => promise . value )
151150 }
152151 }
@@ -159,26 +158,13 @@ export function _useFirestoreRef(
159158 }
160159
161160 // allow to destructure the returned value
162- Object . defineProperties ( data , {
163- error : {
164- get : ( ) => error ,
165- } ,
166- data : {
167- get : ( ) => data ,
168- } ,
169- pending : {
170- get : ( ) => pending ,
171- } ,
172- promise : {
173- get : ( ) => promise ,
174- } ,
175- unbind : {
176- get : ( ) => unbind ,
177- } ,
161+ return Object . defineProperties ( data as _RefFirestore < unknown > , {
162+ error : { get : ( ) => error } ,
163+ data : { get : ( ) => data } ,
164+ pending : { get : ( ) => pending } ,
165+ promise : { get : ( ) => promise } ,
166+ stop : { get : ( ) => stop } ,
178167 } )
179-
180- // no unwrapRef to have a simpler type
181- return data as _RefFirestore < unknown >
182168}
183169
184170export interface UseCollectionOptions extends _UseFirestoreRefOptions { }
@@ -194,7 +180,6 @@ export function useCollection<
194180 // explicit generic as unknown to allow arbitrary types like numbers or strings
195181 R extends CollectionReference < unknown > | Query < unknown >
196182> (
197- // TODO: add MaybeRef
198183 collectionRef : _MaybeRef < _Nullable < R > > ,
199184 options ?: UseCollectionOptions
200185) : _RefFirestore < _InferReferenceType < R > [ ] >
@@ -224,7 +209,7 @@ export function useCollection<T>(
224209 } ) as _RefFirestore < VueFirestoreQueryData < T > >
225210}
226211
227- // TODO: split document and collection into two different parts
212+ // TODO: split document and collection into two different files
228213
229214export interface UseDocumentOptions extends _UseFirestoreRefOptions { }
230215
0 commit comments