loadAndScroll: Use one transaction to pull all data: old/new/metrics

This commit is contained in:
Scott Nonnenberg 2021-12-20 13:05:13 -08:00 committed by GitHub
parent 60a53656af
commit 0163ef203b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 132 additions and 16 deletions

View file

@ -451,6 +451,7 @@ export type DataInterface = {
conversationId: string,
storyId?: UUIDStringType
) => Promise<ConversationMetricsType>;
// getConversationRangeCenteredOnMessage is JSON on server, full message on client
getLastConversationMessages: (options: {
conversationId: string;
ourUuid: UUIDStringType;
@ -622,6 +623,18 @@ export type ServerInterface = DataInterface & {
storyId?: UUIDStringType;
}
) => Promise<Array<MessageTypeUnhydrated>>;
getConversationRangeCenteredOnMessage: (options: {
conversationId: string;
limit?: number;
messageId: string;
receivedAt: number;
sentAt?: number;
storyId?: UUIDStringType;
}) => Promise<{
older: Array<MessageTypeUnhydrated>;
newer: Array<MessageTypeUnhydrated>;
metrics: ConversationMetricsType;
}>;
// Server-only
@ -681,6 +694,18 @@ export type ClientInterface = DataInterface & {
storyId?: UUIDStringType;
}
) => Promise<Array<MessageAttributesType>>;
getConversationRangeCenteredOnMessage: (options: {
conversationId: string;
limit?: number;
messageId: string;
receivedAt: number;
sentAt?: number;
storyId?: UUIDStringType;
}) => Promise<{
older: Array<MessageAttributesType>;
newer: Array<MessageAttributesType>;
metrics: ConversationMetricsType;
}>;
// Client-side only