CyCraft / CyCraft/magnetar

add `startAfter` usage example

Open
#91 0 comments 0 reactions 0 assignees View on GitHub
documentation
Dominant language
TypeScript
Stars
46
Forks
6
PR merge metrics
No merged PRs in 30d

Description

required setup:
```js
const profileCollection = magnetar.collection('profiles').where('show', '==', true).where('archived', '==', false)

const query = profileCollection
.orderBy('lastActiveOrSomething')
.limit(50)

const lastProfile = computed(() => {
return [...profileCollection.orderBy('lastActiveOrSomething').data.values()].pop()
})
```
then either:
```js
const profiles = ref([])

const fetchMore = async () => {
const newProfiles = await query.startAfter(lastProfile.value).fetch()
// push to profiles
profiles.value.push(...newProfiles)
}
```
or
```js
const fetchMore = async () => {
await query.startAfter(lastProfile.value).fetch()
}
```
and
```html

{{ [...profiles.data.values()] }}

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.