Virtualize search results - only render what's visible
This commit is contained in:
parent
9d4f2afa5a
commit
6292019d30
19 changed files with 1633 additions and 438 deletions
|
@ -8,7 +8,9 @@ import { ContactName } from './conversation/ContactName';
|
|||
|
||||
import { LocalizerType } from '../types/Util';
|
||||
|
||||
export type PropsData = {
|
||||
export type PropsDataType = {
|
||||
isSelected?: boolean;
|
||||
|
||||
id: string;
|
||||
conversationId: string;
|
||||
receivedAt: number;
|
||||
|
@ -33,16 +35,17 @@ export type PropsData = {
|
|||
};
|
||||
};
|
||||
|
||||
type PropsHousekeeping = {
|
||||
isSelected?: boolean;
|
||||
|
||||
type PropsHousekeepingType = {
|
||||
i18n: LocalizerType;
|
||||
onClick: (conversationId: string, messageId?: string) => void;
|
||||
openConversationInternal: (
|
||||
conversationId: string,
|
||||
messageId?: string
|
||||
) => void;
|
||||
};
|
||||
|
||||
type Props = PropsData & PropsHousekeeping;
|
||||
type PropsType = PropsDataType & PropsHousekeepingType;
|
||||
|
||||
export class MessageSearchResult extends React.PureComponent<Props> {
|
||||
export class MessageSearchResult extends React.PureComponent<PropsType> {
|
||||
public renderFromName() {
|
||||
const { from, i18n, to } = this.props;
|
||||
|
||||
|
@ -123,7 +126,7 @@ export class MessageSearchResult extends React.PureComponent<Props> {
|
|||
id,
|
||||
isSelected,
|
||||
conversationId,
|
||||
onClick,
|
||||
openConversationInternal,
|
||||
receivedAt,
|
||||
snippet,
|
||||
to,
|
||||
|
@ -137,8 +140,8 @@ export class MessageSearchResult extends React.PureComponent<Props> {
|
|||
<div
|
||||
role="button"
|
||||
onClick={() => {
|
||||
if (onClick) {
|
||||
onClick(conversationId, id);
|
||||
if (openConversationInternal) {
|
||||
openConversationInternal(conversationId, id);
|
||||
}
|
||||
}}
|
||||
className={classNames(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue