Przeglądaj źródła

临时代码 setSentData(initValue);

visuddhinanda 2 lat temu
rodzic
commit
6a46f58121

+ 6 - 5
dashboard/src/components/template/SentEdit/SentCell.tsx

@@ -36,11 +36,11 @@ const SentCellWidget = ({
   const endings = useAppSelector(getEnding);
   const acceptPr = useAppSelector(sentence);
   const [prOpen, setPrOpen] = useState(false);
-  /*
+
   useEffect(() => {
-    setSentData(data);
-  }, [data]);
-*/
+    setSentData(initValue);
+  }, [initValue]);
+
   useEffect(() => {
     if (typeof acceptPr !== "undefined" && !isPr) {
       if (
@@ -53,7 +53,8 @@ const SentCellWidget = ({
         setSentData(acceptPr);
     }
   }, [acceptPr, initValue, isPr]);
-  const sid = `${sentData.book}_${sentData.para}_${sentData.wordStart}_${sentData.wordEnd}_${sentData.channel.id}`;
+
+  const sid = `${sentData?.book}_${sentData?.para}_${sentData?.wordStart}_${sentData?.wordEnd}_${sentData?.channel.id}`;
 
   return (
     <div style={{ marginBottom: "8px" }}>