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

discussionMessage.resId 存在 才变色

visuddhinanda 2 лет назад
Родитель
Сommit
a72c01a006
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      dashboard/src/components/template/SentEdit/SentCell.tsx

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

@@ -46,12 +46,16 @@ const SentCellWidget = ({
   const anchorInfo = useAppSelector(anchor);
   const sid = `${sentData?.book}_${sentData?.para}_${sentData?.wordStart}_${sentData?.wordEnd}_${sentData?.channel.id}`;
   useEffect(() => {
-    if (discussionMessage && discussionMessage.resId === initValue?.id) {
+    if (
+      discussionMessage &&
+      discussionMessage.resId &&
+      discussionMessage.resId === initValue?.id
+    ) {
       setBgColor("wheat");
     } else {
       setBgColor("unset");
     }
-  }, [discussionMessage?.resId, initValue?.id]);
+  }, [discussionMessage, initValue?.id]);
 
   useEffect(() => {
     if (anchorInfo && anchorInfo?.resId === initValue?.id) {