aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-08-05 23:29:14 +0800
committercrupest <crupest@outlook.com>2020-08-05 23:29:14 +0800
commit2f39aae59e150e93748a60d6f8202d5c6790b3b7 (patch)
tree0d57e19dc215673d362d437d124b4bcad5bb08c6 /Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx
parent6177e4fc237aedf62b7d6011f19f04d98c26da39 (diff)
downloadtimeline-2f39aae59e150e93748a60d6f8202d5c6790b3b7.tar.gz
timeline-2f39aae59e150e93748a60d6f8202d5c6790b3b7.tar.bz2
timeline-2f39aae59e150e93748a60d6f8202d5c6790b3b7.zip
Refactor a lot.
Diffstat (limited to 'Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx')
-rw-r--r--Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx8
1 files changed, 7 insertions, 1 deletions
diff --git a/Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx b/Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx
index 42171e13..43925ebb 100644
--- a/Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx
+++ b/Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx
@@ -24,7 +24,7 @@ import Timeline, {
import AppBar from '../common/AppBar';
import TimelinePostEdit, { TimelinePostSendCallback } from './TimelinePostEdit';
-type TimelinePostSyncState = 'syncing' | 'synced' | 'offline';
+type TimelinePostSyncState = 'loadcache' | 'syncing' | 'synced' | 'offline';
const TimelinePostSyncStateBadge: React.FC<{
state: TimelinePostSyncState;
@@ -37,6 +37,7 @@ const TimelinePostSyncStateBadge: React.FC<{
<div style={style} className={clsx('timeline-sync-state-badge', className)}>
{(() => {
switch (state) {
+ case 'loadcache':
case 'syncing': {
return (
<>
@@ -200,6 +201,11 @@ export default function TimelinePageTemplateUI<TManageItems>(
if (timeline != null) {
let timelineBody: React.ReactElement;
if (postListState != null) {
+ if (postListState.posts == null) {
+ throw new UiLogicError(
+ "Timeline is not null but postListState is 'timeline-notexist or 'timeline-offline'."
+ );
+ }
if (postListState.state === 'forbid') {
timelineBody = (
<p className="text-danger">{t('timeline.messageCantSee')}</p>