Split email cache into full content and stubs.
This also introduces status for in-flight requests to avoid perpetual, unnecessary loops of change-the-re-get-data.
This commit is contained in:
parent
fb53a7506f
commit
4e1922c5fa
8 changed files with 219 additions and 47 deletions
|
|
@ -2,13 +2,13 @@ import React from "react";
|
|||
import Placeholder from "react-bootstrap/Placeholder";
|
||||
|
||||
import Client from "./client/Client";
|
||||
import { IAccount, IEmail, IMailbox } from "./client/types";
|
||||
import { IAccount, IEmailStub, IMailbox } from "./client/types";
|
||||
|
||||
type EmailSummaryProps = {
|
||||
account: IAccount | null;
|
||||
client: Client | null;
|
||||
email: IEmail | null;
|
||||
emailId: string;
|
||||
emailStub: IEmailStub | null;
|
||||
mailbox: IMailbox | null;
|
||||
};
|
||||
type EmailSummaryState = {};
|
||||
|
|
@ -27,7 +27,10 @@ class EmailSummary extends React.Component<
|
|||
ensureData() {
|
||||
if (this.props.account == null) return;
|
||||
if (this.props.client == null) return;
|
||||
this.props.client.ensureEmailGet(this.props.account.id, this.props.emailId);
|
||||
this.props.client.ensureEmailStub(
|
||||
this.props.account.id,
|
||||
this.props.emailId,
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
@ -48,8 +51,8 @@ class EmailSummary extends React.Component<
|
|||
return (
|
||||
<div className="p-2 border" key={this.props.emailId}>
|
||||
<a className="btn" href={href}>
|
||||
{this.props.email != null
|
||||
? this.props.email.subject
|
||||
{this.props.emailStub != null
|
||||
? this.props.emailStub.subject
|
||||
: this.props.emailId}
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue