Hook to get the scrollback action for a stream.
Scrollback is the action of getting miniblocks from a stream before a certain point in time. Getting miniblocks means that new events that are possibly new messages, reactions and so on are fetched.
Imports
import { useScrollback } from '@towns-protocol/react-sdk'
Definition
function useScrollback(
streamId: string,
config?: ActionConfig<MessageTimeline["scrollback"]>,
): {
data: {
terminus: boolean;
fromInclusiveMiniblockNum: bigint;
} | undefined;
error: Error | undefined;
isPending: boolean;
isSuccess: boolean;
isError: boolean;
scrollback: () => Promise<{
terminus: boolean;
fromInclusiveMiniblockNum: bigint;
}>;
}
Source: useScrollback
Parameters
streamId
The id of the stream to get the scrollback action for.
config
- Type:
ActionConfig<MessageTimeline["scrollback"]>
- Optional
Configuration options for the action.
Return Type
The scrollback
action and its loading state.
{
data: {
terminus: boolean;
fromInclusiveMiniblockNum: bigint;
} | undefined;
error: Error | undefined;
isPending: boolean;
isSuccess: boolean;
isError: boolean;
scrollback: () => Promise<{
terminus: boolean;
fromInclusiveMiniblockNum: bigint;
}>;
}