|
@@ -1,5 +1,5 @@
|
|
|
import { View, Text } from "@tarojs/components";
|
|
|
-import Taro, { useReachBottom } from "@tarojs/taro";
|
|
|
+import Taro, { useDidShow, useReachBottom } from "@tarojs/taro";
|
|
|
import VisitorCard from "../VisitorCard/index";
|
|
|
|
|
|
import { TVisitorAgent } from "@/types/visitor";
|
|
@@ -15,7 +15,7 @@ export default ({ agentId }: IProps) => {
|
|
|
const res = await getVisitorList({ startId: nextId, pageSize, agentId });
|
|
|
return res.data;
|
|
|
};
|
|
|
- const { list, loadMore } = useLoadMoreInfinite<TVisitorAgent>(
|
|
|
+ const { list, loadMore, mutate } = useLoadMoreInfinite<TVisitorAgent[]>(
|
|
|
createKey(`getVisitorList${agentId}`, 10, [agentId]),
|
|
|
fetcher);
|
|
|
|
|
@@ -23,6 +23,10 @@ export default ({ agentId }: IProps) => {
|
|
|
loadMore();
|
|
|
});
|
|
|
|
|
|
+ useDidShow(()=> {
|
|
|
+ mutate(undefined, {revalidate: true})
|
|
|
+ })
|
|
|
+
|
|
|
|
|
|
|
|
|
if (!list.length) {
|