Flarum (2.x)
    Preparing search index...

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    eventEmitter: EventEmitter
    extraDiscussions: Discussion[] = []
    initialLoading: boolean = false
    loadingNext: boolean = false
    loadingPage: boolean = false
    loadingPrev: boolean = false
    pages: Page<Discussion>[] = []
    pageSize: number | null
    params: P = ...
    revalidating: Promise<void> | null = null

    The in-flight background refresh, if any. Deliberately not part of the isLoading() family: a revalidation is invisible by design, so exposing it there would put the loading state back on screen.

    totalItems: number | null = null
    DEFAULT_PAGE_SIZE: number = 20

    This value should not be relied upon when preloading an API document. In those cases the pageSize should be taken from the meta information of the preloaded document. Checkout DiscussionListState.loadPage for an example.

    Accessors

    Methods

    • Reconcile the realtime additions after a background revalidation.

      refresh() empties extraDiscussions, because it routes through clear(). revalidate() deliberately does not clear anything before it asks the API, so it rebuilds pages and leaves extraDiscussions alone — and the first page it gets back contains exactly the discussions realtime put there, since a new post is what moved them to the top. Left unhandled they render from both places at once, which is what a reader coming back to an idle tab sees as a duplicate.

      Only the ids the new pages actually contain are dropped. A revalidation that failed resolves rather than rejecting and leaves pages untouched, so clearing unconditionally would take realtime's additions off a list that was never reloaded.

      Returns Promise<void>