Sfoglia il codice sorgente

Merge pull request #1439 from visuddhinanda/agile

if (discussionMessage &&
visuddhinanda 2 anni fa
parent
commit
53a166b0de

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

@@ -46,7 +46,7 @@ const SentCellWidget = ({
   const anchorInfo = useAppSelector(anchor);
   const anchorInfo = useAppSelector(anchor);
   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}`;
   useEffect(() => {
   useEffect(() => {
-    if (discussionMessage?.resId === initValue?.id) {
+    if (discussionMessage && discussionMessage.resId === initValue?.id) {
       setBgColor("wheat");
       setBgColor("wheat");
     } else {
     } else {
       setBgColor("unset");
       setBgColor("unset");
@@ -54,7 +54,7 @@ const SentCellWidget = ({
   }, [discussionMessage?.resId, initValue?.id]);
   }, [discussionMessage?.resId, initValue?.id]);
 
 
   useEffect(() => {
   useEffect(() => {
-    if (anchorInfo?.resId === initValue?.id) {
+    if (anchorInfo && anchorInfo?.resId === initValue?.id) {
       const ele = document.getElementById(sid);
       const ele = document.getElementById(sid);
       ele?.scrollIntoView();
       ele?.scrollIntoView();
     }
     }