From 3f6dbd2bd0fc8c9439733c88f6c169ed28c2def7 Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 14 Feb 2021 17:29:11 +0800 Subject: ... --- .../app/views/timeline-common/TimelinePostContentView.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'FrontEnd/src/app/views/timeline-common/TimelinePostContentView.tsx') diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePostContentView.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePostContentView.tsx index 35d091af..2f5d3989 100644 --- a/FrontEnd/src/app/views/timeline-common/TimelinePostContentView.tsx +++ b/FrontEnd/src/app/views/timeline-common/TimelinePostContentView.tsx @@ -7,6 +7,7 @@ import { getHttpTimelineClient, HttpTimelinePostInfo } from "@/http/timeline"; import { useUser } from "@/services/user"; import Skeleton from "../common/Skeleton"; +import LoadFailReload from "../common/LoadFailReload"; const TextView: React.FC = (props) => { const { post, className, style } = props; @@ -14,6 +15,8 @@ const TextView: React.FC = (props) => { const [text, setText] = React.useState(null); const [error, setError] = React.useState<"offline" | "error" | null>(null); + const [reloadKey, setReloadKey] = React.useState(0); + React.useEffect(() => { let subscribe = true; @@ -40,14 +43,15 @@ const TextView: React.FC = (props) => { return () => { subscribe = false; }; - }, [post.timelineName, post.id]); + }, [post.timelineName, post.id, reloadKey]); if (error != null) { - // TODO: i18n return ( -
- Error! -
+ setReloadKey(reloadKey + 1)} + /> ); } else if (text == null) { return ; @@ -109,6 +113,7 @@ const TimelinePostContentView: React.FC = ( return ; } else { // TODO: i18n + console.error("Unknown post type", post); return
Error, unknown post type!
; } }; -- cgit v1.2.3