|
@@ -1,4 +1,4 @@
|
|
-import Taro, { useReachBottom } from "@tarojs/taro";
|
|
|
|
|
|
+import Taro, { useDidShow, useReachBottom } from "@tarojs/taro";
|
|
import { View, Text } from "@tarojs/components";
|
|
import { View, Text } from "@tarojs/components";
|
|
import EmptyData from "@/components/empty-data";
|
|
import EmptyData from "@/components/empty-data";
|
|
import NavBarNormal from "@/components/NavBarNormal/index";
|
|
import NavBarNormal from "@/components/NavBarNormal/index";
|
|
@@ -42,7 +42,7 @@ export default function Index() {
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|
|
};
|
|
};
|
|
- const {list, setSize} = useLoadMoreInfinite<TContactItem>(getKey, fetcher)
|
|
|
|
|
|
+ const {list, setSize, mutate} = useLoadMoreInfinite<TContactItem[]>(getKey, fetcher)
|
|
|
|
|
|
|
|
|
|
const resetFetchList = () => {
|
|
const resetFetchList = () => {
|
|
@@ -77,12 +77,16 @@ export default function Index() {
|
|
contactId: detail.id,
|
|
contactId: detail.id,
|
|
});
|
|
});
|
|
if (isSuccess(reseponse.status)) {
|
|
if (isSuccess(reseponse.status)) {
|
|
- resetFetchList();
|
|
|
|
|
|
+ mutate()
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ useDidShow(() => {
|
|
|
|
+ mutate(undefined, {revalidate:true})
|
|
|
|
+ })
|
|
|
|
+
|
|
const renderContent = () => {
|
|
const renderContent = () => {
|
|
if (list?.length) {
|
|
if (list?.length) {
|
|
return list.map((item) => (
|
|
return list.map((item) => (
|