Browse Source

if (_data.editor.length > 0)

visuddhinanda 2 years ago
parent
commit
f3fd72147e
1 changed files with 4 additions and 3 deletions
  1. 4 3
      dashboard/src/components/dict/Community.tsx

+ 4 - 3
dashboard/src/components/dict/Community.tsx

@@ -49,9 +49,7 @@ const CommunityWidget = ({ word }: IWidget) => {
           console.log("dict community", json.message);
           console.log("dict community", json.message);
           return;
           return;
         }
         }
-        if (json.data.count > 0) {
-          setLoaded(true);
-        }
+
         let meaning = new Map<string, number>();
         let meaning = new Map<string, number>();
         let grammar = new Map<string, number>();
         let grammar = new Map<string, number>();
         let parent = new Map<string, number>();
         let parent = new Map<string, number>();
@@ -121,6 +119,9 @@ const CommunityWidget = ({ word }: IWidget) => {
         });
         });
         _data.editor.sort((a, b) => b.score - a.score);
         _data.editor.sort((a, b) => b.score - a.score);
         setWordData(_data);
         setWordData(_data);
+        if (_data.editor.length > 0) {
+          setLoaded(true);
+        }
       })
       })
       .catch((error) => {
       .catch((error) => {
         console.error(error);
         console.error(error);