瀏覽代碼

:bug: id=undefind 报错

visuddhinanda 3 年之前
父節點
當前提交
6bb093eace
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      dashboard/src/components/template/SentEdit/SentTab.tsx

+ 3 - 0
dashboard/src/components/template/SentEdit/SentTab.tsx

@@ -25,6 +25,9 @@ const Widget = ({
   const [nissayaActive, setNissayaActive] = useState<boolean>(false);
   const [commentaryActive, setCommentaryActive] = useState<boolean>(false);
   const [originalActive, setOriginalActive] = useState<boolean>(false);
+  if (typeof id === "undefined") {
+    return <></>;
+  }
   const sentId = id.split("_");
 
   const onChange = (key: string) => {