From c7a3813b8c64152e91fdd0f99e8f0baf0fef4678 Mon Sep 17 00:00:00 2001 From: crupest Date: Sat, 13 Feb 2021 21:55:47 +0800 Subject: ... --- .../src/app/views/timeline-common/Timeline.tsx | 25 ++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'FrontEnd/src/app/views/timeline-common/Timeline.tsx') diff --git a/FrontEnd/src/app/views/timeline-common/Timeline.tsx b/FrontEnd/src/app/views/timeline-common/Timeline.tsx index d41588bb..07ca2924 100644 --- a/FrontEnd/src/app/views/timeline-common/Timeline.tsx +++ b/FrontEnd/src/app/views/timeline-common/Timeline.tsx @@ -15,10 +15,20 @@ export interface TimelineProps { timelineName: string; reloadKey: number; onReload: () => void; + additionalPosts?: HttpTimelinePostInfo[]; + onLoad?: () => void; } const Timeline: React.FC = (props) => { - const { timelineName, className, style, reloadKey, onReload } = props; + const { + timelineName, + className, + style, + reloadKey, + onReload, + additionalPosts, + onLoad, + } = props; const [posts, setPosts] = React.useState< | HttpTimelinePostInfo[] @@ -59,6 +69,12 @@ const Timeline: React.FC = (props) => { }; }, [timelineName, reloadKey]); + React.useEffect(() => { + if (Array.isArray(posts)) { + onLoad?.(); + } + }, [posts, additionalPosts, onLoad]); + switch (posts) { case "loading": return ( @@ -91,7 +107,12 @@ const Timeline: React.FC = (props) => { ); default: - return ; + return ( + + ); } }; -- cgit v1.2.3