Unbind useCollection
on logout
#1446
-
Reproductionhttps://github.com/mrleblanc101/neobigben/tree/feature/firebase Steps to reproduce the bugI have a useCollection that has a dynamic where to fetch only the user data like so: const entries = useCollection<Entry>(
computed(() =>
query(
collection(db, 'entries').withConverter(dateConverter),
+ where('user', '==', user.value?.uid),
where('date', '>=', weekStart.value),
where('date', '<=', weekEnd.value),
),
),
{
ssrKey: 'entries',
},
); When I logout, I have this specific error:
This is because my computed query gets updated when the Expected behaviorMy best guess has been to overwrite the value of
Since Actual behaviorI still get the error. Additional informationNo response |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
You need to ensure the correct values are being passed: const entries = useCollection<Entry>(
computed(() =>
user.value
? query(
collection(db, 'entries').withConverter(dateConverter),
where('user', '==', user.value.uid),
where('date', '>=', weekStart.value),
where('date', '<=', weekEnd.value),
)
: null,
),
{
ssrKey: 'entries',
},
); VueFire allows passing |
Beta Was this translation helpful? Give feedback.
-
BTW I don't feel respected if you keep opening issues without following the issue opening guidelines. Specifically, the boiled-down reproduction. It really makes me feel treated like free support which I don't appreciate. The more you repeat it, the less likely I, or any open-source maintainer, will want to help out. You can still open discussions for help, that's what they are for, you can even use them exactly the way you are using the issues right now, writing down your thoughts and journey trying to find the source of a problem. This will probably help other users facing similar issues. So please, open discussions if you are looking for help, as indicated in the issue guidelines and I will gladly give it a look! Thank you. |
Beta Was this translation helpful? Give feedback.
-
Helpful note since I just spent an afternoon working through a similar bug I needed to set the reset option on the useCollection call so I think maybe you might have to add it like this? I don't know if that'll solve your issue but it fixed my few hours of troubleshooting and wanted to pass it along! :)
|
Beta Was this translation helpful? Give feedback.
You need to ensure the correct values are being passed:
VueFire allows passing
null
to these functions for this purpose. There is even an example in docs