Просмотр исходного кода

Merge pull request #1362 from visuddhinanda/agile

#1356
visuddhinanda 2 лет назад
Родитель
Сommit
be4c8ae87b

+ 2 - 2
dashboard/src/components/template/SentEdit/SentCanRead.tsx

@@ -108,7 +108,7 @@ const SentCanReadWidget = ({
           if (typeof user === "undefined") {
             return;
           }
-          const sentData: ISentence = {
+          const newSent: ISentence = {
             content: "",
             contentType: "markdown",
             html: "",
@@ -127,7 +127,7 @@ const SentCanReadWidget = ({
             openInEditMode: true,
           };
           setSentData((origin) => {
-            return [sentData, ...origin];
+            return [newSent, ...origin];
           });
         }}
       />

+ 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" }}>

+ 0 - 1
dashboard/src/components/template/SentEdit/SentContent.tsx

@@ -72,7 +72,6 @@ const SentContentWidget = ({
   const newMode = useAppSelector(_mode);
 
   useEffect(() => {
-    console.log("mode", mode);
     let currMode: ArticleMode;
     if (typeof mode !== "undefined") {
       currMode = mode;