2
0
Эх сурвалжийг харах

if (_data.editor.length > 0)

visuddhinanda 2 жил өмнө
parent
commit
f3fd72147e

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

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