Dynamic ref in where clause #1436
-
| Hi,  | 
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 7 replies
-
| I got it working with a  Since useCollection return a ref, and computed return a ref, I had to use  So now I can use  | 
Beta Was this translation helpful? Give feedback.
-
| After all, this might not be the solution, it look like it's working, but I get this warning in the console and the app become slow to a crawl 
 EDIT: I figure that when the  | 
Beta Was this translation helpful? Give feedback.
-
| Just tried a watcher like so: But I get a different warning, I use Nuxt 3, but I do not use SSR because I host my app on Github Pages with  
 | 
Beta Was this translation helpful? Give feedback.
-
| You are very close! You need to pass a reactive value to  const entries = useCollection<Entry>(() =>
    query(
        collection(db, 'entries').withConverter(dateConverter),
        where('user', '==', user.value?.uid),
        where('date', '>', $moment(selectedDay.value).startOf('week').toDate()),
        where('date', '<', $moment(selectedDay.value).endOf('week').toDate()),
    ),
    {
        ssrKey: 'entries',
    },
);Watchers are not meant for this, neither are passing the  | 
Beta Was this translation helpful? Give feedback.
-
| So the getter does not work, but experimenting from what you said in your previous comment, I wrapper my query in a computed and now it seem to work (instead of wrapping the whole useCollection which is what I tried earlier):  | 
Beta Was this translation helpful? Give feedback.


You are very close! You need to pass a reactive value to
useCollection()there are some extra tips in docs but this is the shortest version, passing a function getter:Watchers are not meant for this, neither are passing the
useCollection()to acomputed(), it's the other way around. The lightest is just auseCollection((…