invitation flow finished
This commit is contained in:
1 parent
0817e8e72b
commit
d4fae890bb
5 files changed
+26
-9
No files matched your search
@@ -365,6 +365,21 @@ export function useInvitations(gymId?: string) {
|
||||
(res) => res.data?.invitations ?? [],
|
||||
);
|
||||
},
|
||||
refetchInterval: (query) => {
|
||||
const data = query.state.data;
|
||||
const hasData = data && data.length > 0;
|
||||
const fetchCount = query.state.dataUpdateCount;
|
||||
|
||||
// Poll every 2 seconds if:
|
||||
// 1. No invitations returned yet
|
||||
// 2. Haven't exceeded 5 attempts (10 seconds total)
|
||||
if (!hasData && fetchCount < 5) {
|
||||
return 2000;
|
||||
}
|
||||
|
||||
// Stop polling after 10 seconds or when data is present
|
||||
return false;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user