diff options
author | crupest <crupest@outlook.com> | 2020-08-05 23:29:14 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-08-05 23:29:14 +0800 |
commit | be9eb313ccad0832cb37e1c63e03608c47c2d171 (patch) | |
tree | e989d42596f60b5b2157341edb5ec7ea648d1881 /Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx | |
parent | 0791682e1f333adb5c79b979e3e8c5c50bb5f85a (diff) | |
download | timeline-be9eb313ccad0832cb37e1c63e03608c47c2d171.tar.gz timeline-be9eb313ccad0832cb37e1c63e03608c47c2d171.tar.bz2 timeline-be9eb313ccad0832cb37e1c63e03608c47c2d171.zip |
Refactor a lot.
Diffstat (limited to 'Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx')
-rw-r--r-- | Timeline/ClientApp/src/app/timeline/TimelinePageTemplateUI.tsx | 8 |
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>
|