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(firebase) useFireRef for useFirestore #2284

Closed
4 tasks done
Zehir opened this issue Oct 2, 2022 · 3 comments
Closed
4 tasks done

feat(firebase) useFireRef for useFirestore #2284

Zehir opened this issue Oct 2, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@Zehir
Copy link
Contributor

Zehir commented Oct 2, 2022

Clear and concise description of the problem

Since #2103 now support ref as document fire references I think it's could be nice to have a way to generate document references or queries.

Suggested solution

Using something like this to generate the path of the document / collection;

export function concatenatePath(...paths: MaybeRef<string | undefined>[]) {
  return computed(() => {
    if (useArraySome(paths, path => path === undefined).value)
      return undefined
    return useArrayReduce(paths, (fullPath = '', path) => fullPath += `/${resolveUnref(path)}`)
      .value?.replaceAll(/[\/]{2,}/g, '/')
  })
}

And then use a MaybeRef<QueryConstraint | undefined>[] for the query filter.

Also to avoid passing the reference of the fireapp maybe create a global state like createFirebase and pass the app name to the useFireRef

useFireRef(
    appName : string | FireApp,
    documentPath : MaybeRef<string | undefined>[],
    queryContraints : MaybeRef<QueryConstraint | undefined>[]
) : DocumentReference | Query | undefined

Alternative

No response

Additional context

No response

Validations

@Zehir Zehir added the enhancement New feature or request label Oct 2, 2022
@stale
Copy link

stale bot commented Dec 1, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@Zehir
Copy link
Contributor Author

Zehir commented Dec 1, 2022

Up

@stale
Copy link

stale bot commented Jan 30, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 30, 2023
@Zehir Zehir closed this as completed Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant