Browse Source

fix: 个人知识库列表显示时重新获取数据

王晓东 2 tuần trước cách đây
mục cha
commit
0efd53e673

+ 1 - 1
package.json

@@ -10,7 +10,7 @@
     "framework": "React"
   },
   "engines": {
-    "node": "^v18.17.0"
+    "node": "^v20.19.0"
   },
   "scripts": {
     "devbuild:weapp": "taro build --type weapp --watch --env production",

+ 3 - 2
src/pages/knowledge/components/PersonalTab/components/ScrollList.tsx

@@ -39,8 +39,9 @@ const Index = ({ types, setTotalCount }: IProps) => {
     loadMore();
   };
 
+  // 此处 useDidShow 将不会起作用,因为页面渲染后,此组件还没有渲染
   useDidShow(() => {
-    mutate(undefined, { revalidate: true });
+    mutate();
   });
 
   let timer:any = undefined
@@ -54,7 +55,7 @@ const Index = ({ types, setTotalCount }: IProps) => {
   }, [list])
 
   useEffect(() => {
-    if (data && pageIndex === 1) {
+    if (pageIndex === 1) {
       setTotalCount(data?.[0].totalCount || 0);
     }
   }, [data, pageIndex]);