Skip to content

add startAfter usage example #91

@mesqueeb

Description

@mesqueeb

required setup:

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:

const profiles = ref([])

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

or

const fetchMore = async () => {
  await query.startAfter(lastProfile.value).fetch()
}

and

<template>
  {{ [...profiles.data.values()] }}
</template>

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions