Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(useFirestore): support dependent queries #2103

Merged
merged 4 commits into from Sep 26, 2022
Merged

Conversation

kiyopikko
Copy link
Contributor

@kiyopikko kiyopikko commented Aug 19, 2022

Description

Enable to use the boolean value to tell a query when it is ready to run.

const userId = ref('')
const docRef = computed(() => !!userId.value && doc(db, 'users', userId.value))
const userData = useFirestore(docRef, null)

userId.value = 'userId' // start querying

Additional context

Fixes #2018 @smakinson

You can avoid invalid segment error of firestore path.

Similar interface of https://github.com/Kong/swrv#dependent-fetching


What is the purpose of this pull request?

  • New Feature
  • Documentation update

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).

@smakinson
Copy link

I appreciate this, thank you!

@MitchSRobinson
Copy link

Hi there, any news on this PR?? I'm currently blocked from properly using useFirestore without this feature so any updates would be appreciated

@kiyopikko
Copy link
Contributor Author

I removed unnecessary function interface. it's enough to use computed.

@antfu antfu merged commit 2188b85 into vueuse:main Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useFirestore for docs, collections or queries that include an auth users id in the path
4 participants