From a8a8385cd959e4d9d57b8a35381d2851049c07ff Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Thu, 21 Sep 2023 21:05:04 +0800
Subject: ...

---
 .../src/pages/timeline/view/MarkdownPostView.tsx   | 23 +++++++++++-----------
 1 file changed, 11 insertions(+), 12 deletions(-)

(limited to 'FrontEnd/src/pages/timeline/view/MarkdownPostView.tsx')

diff --git a/FrontEnd/src/pages/timeline/view/MarkdownPostView.tsx b/FrontEnd/src/pages/timeline/view/MarkdownPostView.tsx
index 9bb9f980..d0a43f7d 100644
--- a/FrontEnd/src/pages/timeline/view/MarkdownPostView.tsx
+++ b/FrontEnd/src/pages/timeline/view/MarkdownPostView.tsx
@@ -1,4 +1,4 @@
-import { useMemo, useState } from "react";
+import { useEffect, useMemo, useState } from "react";
 import { marked } from "marked";
 import classNames from "classnames";
 
@@ -7,7 +7,7 @@ import {
   getHttpTimelineClient,
 } from "~src/http/timeline";
 
-import { useAutoUnsubscribePromise } from "~src/components/hooks";
+import { subscribePromise } from "~src/components/utilities";
 import Skeleton from "~src/components/Skeleton";
 
 import "./MarkdownPostView.css";
@@ -23,19 +23,18 @@ export default function MarkdownPostView({
 }: MarkdownPostViewProps) {
   const [markdown, setMarkdown] = useState<string | null>(null);
 
-  useAutoUnsubscribePromise(
-    () => {
-      if (post) {
-        return getHttpTimelineClient().getPostDataAsString(
+  useEffect(() => {
+    if (post) {
+      return subscribePromise(
+        getHttpTimelineClient().getPostDataAsString(
           post.timelineOwnerV2,
           post.timelineNameV2,
           post.id,
-        );
-      }
-    },
-    setMarkdown,
-    [post],
-  );
+        ),
+        setMarkdown,
+      );
+    }
+  }, [post]);
 
   const markdownHtml = useMemo<string | null>(() => {
     if (markdown == null) return null;
-- 
cgit v1.2.3

