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/PlainTextPostView.tsx  | 23 +++++++++++-----------
 1 file changed, 11 insertions(+), 12 deletions(-)

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

diff --git a/FrontEnd/src/pages/timeline/view/PlainTextPostView.tsx b/FrontEnd/src/pages/timeline/view/PlainTextPostView.tsx
index b964187d..d66bf05b 100644
--- a/FrontEnd/src/pages/timeline/view/PlainTextPostView.tsx
+++ b/FrontEnd/src/pages/timeline/view/PlainTextPostView.tsx
@@ -1,4 +1,4 @@
-import { useState } from "react";
+import { useEffect, useState } from "react";
 import classNames from "classnames";
 
 import {
@@ -6,8 +6,8 @@ import {
   getHttpTimelineClient,
 } from "~src/http/timeline";
 
+import { subscribePromise } from "~src/components/utilities";
 import Skeleton from "~src/components/Skeleton";
-import { useAutoUnsubscribePromise } from "~src/components/hooks";
 
 import "./PlainTextPostView.css";
 
@@ -22,19 +22,18 @@ export default function PlainTextPostView({
 }: PlainTextPostViewProps) {
   const [text, setText] = useState<string | null>(null);
 
-  useAutoUnsubscribePromise(
-    () => {
-      if (post) {
-        return getHttpTimelineClient().getPostDataAsString(
+  useEffect(() => {
+    if (post) {
+      return subscribePromise(
+        getHttpTimelineClient().getPostDataAsString(
           post.timelineOwnerV2,
           post.timelineNameV2,
           post.id,
-        );
-      }
-    },
-    setText,
-    [post],
-  );
+        ),
+        setText,
+      );
+    }
+  }, [post]);
 
   return (
     <div
-- 
cgit v1.2.3

