function withInOrder
withInOrder<T extends { id: string; }>(
items: T[],
item: T,
compare: (
a: T,
b: T
) => number
): T[]

Returns items, in the order of compare as the API pages them, with item where that order puts it: before the first item that doesn't come before it. An item that comes after every one loaded is left to a later page, and items returned as they are, as they are when item is already there. usePlaylistListSync puts a new, newly visible or risen playlist in a list with it, whatever its order.

Type Parameters

T extends { id: string; }

Parameters

items: T[]
item: T
compare: (
a: T,
b: T
) => number

Return Type

T[]

Usage

import { withInOrder } from "src/utils/feed/pagedList.ts";