diff options
author | crupest <crupest@outlook.com> | 2021-02-13 21:23:30 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-02-13 21:23:30 +0800 |
commit | c8bd19aacf9059f740df4f6fa9890127c20c1f6d (patch) | |
tree | 01b3d74965415aff1ab1ef36fb9c92551c2166a4 /FrontEnd/src/app/views/timeline-common/Timeline.tsx | |
parent | b9703104b5b416dd3211adedb878d1916072c96d (diff) | |
download | timeline-c8bd19aacf9059f740df4f6fa9890127c20c1f6d.tar.gz timeline-c8bd19aacf9059f740df4f6fa9890127c20c1f6d.tar.bz2 timeline-c8bd19aacf9059f740df4f6fa9890127c20c1f6d.zip |
...
Diffstat (limited to 'FrontEnd/src/app/views/timeline-common/Timeline.tsx')
-rw-r--r-- | FrontEnd/src/app/views/timeline-common/Timeline.tsx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/FrontEnd/src/app/views/timeline-common/Timeline.tsx b/FrontEnd/src/app/views/timeline-common/Timeline.tsx index d970af84..d41588bb 100644 --- a/FrontEnd/src/app/views/timeline-common/Timeline.tsx +++ b/FrontEnd/src/app/views/timeline-common/Timeline.tsx @@ -13,10 +13,12 @@ export interface TimelineProps { className?: string; style?: React.CSSProperties; timelineName: string; + reloadKey: number; + onReload: () => void; } const Timeline: React.FC<TimelineProps> = (props) => { - const { timelineName, className, style } = props; + const { timelineName, className, style, reloadKey, onReload } = props; const [posts, setPosts] = React.useState< | HttpTimelinePostInfo[] @@ -30,6 +32,8 @@ const Timeline: React.FC<TimelineProps> = (props) => { React.useEffect(() => { let subscribe = true; + setPosts("loading"); + void getHttpTimelineClient() .listPost(timelineName) .then( @@ -53,7 +57,7 @@ const Timeline: React.FC<TimelineProps> = (props) => { return () => { subscribe = false; }; - }, [timelineName]); + }, [timelineName, reloadKey]); switch (posts) { case "loading": @@ -87,7 +91,7 @@ const Timeline: React.FC<TimelineProps> = (props) => { </div> ); default: - return <TimelinePostListView posts={posts} />; + return <TimelinePostListView posts={posts} onReload={onReload} />; } }; |