Skip to main content

Overview

useFetchManyEventsWrapper wraps useFetchManyEvents into a ready-to-render list: it holds the accumulated events, tracks loading/hasMore, manages sort state, and exposes loadMore and refetch. It mirrors useFetchManyEntitiesWrapper. Visibility is enforced server-side, so the list only contains events the current user may see. The space’s active admins and moderators see every event in their space, invite events included; a host who isn’t an active member of the event’s space sees only what a regular viewer would. See Event visibility. Changing any filter prop (or calling refetch) reloads the list from page 1.

Usage Example

Parameters

number
Page size: a whole number from 1 to 100. Defaults to 10. A larger value is rejected with 400 event/invalid-query, never lowered to 100.
string | "none" | null
Only this space’s events, or "none" for events not in any space. Left out or null: every event.
string | null
Only events this user hosts: events whose hostIds contain them, and events they own.
"online" | "physical" | "hybrid" | null
Filter by type.
"active" | "cancelled" | null
Filter by status.
"upcoming" | "ongoing" | "past" | null
Derived time window.
string | null
ISO datetime lower bound.
string | null
ISO datetime upper bound.
RsvpStatus | RsvpStatus[] | null
Statuses the logged-in user RSVP’d with.
object | null
Proximity filter.
object | null
Free-text filter on title.
object | null
Free-text filter on description.
EventIncludeParam
Associations to expand, as a single value or an array: "user", "space", "files", "userRsvp".
"startTime" | "going"
Initial sort field. Defaults to "startTime".
"asc" | "desc" | null
Initial sort direction. Defaults to null: no direction is sent, so the sort’s natural one applies (soonest first for "startTime", most going first for "going").

Returns

Event[]
The accumulated events.
boolean
true while fetching.
SublayError | null
The last load failure, or null. Cleared when the next load starts; loadMore() retries it. A SublayError.
boolean
true while loadMore() has something to fetch: a next page, or a load that failed.
"startTime" | "going"
Current sort field.
"asc" | "desc" | null
Current sort direction; null means the sort’s natural one.
(s) => void
Change the sort field (resets to page 1).
(d) => void
Change the sort direction (resets to page 1). Pass null to go back to the sort’s natural direction.
() => Promise<void>
Load the next page and append it, or retry the load that failed. Does nothing while a load is running or when there is nothing more. Never rejects: a failure lands in error.
() => Promise<void>
Reload from page 1 with the current filters and sort. The loaded events stay until the new first page replaces them. Never rejects: a failure lands in error.

See Also