diff --git a/src/app/pages/TempleTapAirdrop/index.tsx b/src/app/pages/TempleTapAirdrop/index.tsx
index f6dfa83490..c29f3e7c22 100644
--- a/src/app/pages/TempleTapAirdrop/index.tsx
+++ b/src/app/pages/TempleTapAirdrop/index.tsx
@@ -55,24 +55,26 @@ export const TempleTapAirdropPage = memo(() => {
}, [silentSign, tezos.signer, accountPkh]);
useTypedSWR(
- [accountPkh],
+ ['temple-tap-airdrop-confirm-check', accountPkh],
async () => {
- if (confirmed || !canSign) return;
+ if (confirmed || !canSign) return null;
const sigAuthValues = await prepSigAuthValues();
const confirmedRes = await checkTempleTapAirdropConfirmation(accountPkh, sigAuthValues);
- if (!confirmedRes) return false;
+ if (!confirmedRes) return null;
setConfirmed(true);
+ setStoredRecord(state => ({ ...state, [accountPkh]: true }));
- return true;
+ return null;
},
{
suspense: true,
revalidateOnFocus: false,
- refreshInterval: 60_000
+ refreshInterval: 60_000,
+ errorRetryInterval: 60_000
}
);
@@ -125,7 +127,7 @@ export const TempleTapAirdropPage = memo(() => {
How to receive TKEY?
- {confirmSent && (
+ {confirmSent && !confirmed && (
> = ({ title, description,
{title}
-
{description}
+
{description}
{children}
diff --git a/src/lib/swr/index.ts b/src/lib/swr/index.ts
index 35c2f09ba4..6bc11d74d7 100644
--- a/src/lib/swr/index.ts
+++ b/src/lib/swr/index.ts
@@ -1,16 +1,18 @@
-import useSWR, { Key, SWRConfiguration, SWRResponse } from 'swr';
+import useSWR, { Key, SWRConfiguration } from 'swr';
import { FetcherResponse } from 'swr/_internal';
type Fetcher = (arg: SWRKey) => FetcherResponse;
+/** Fetcher must not return (awaited) `undefined` value - results in endless fetching. */
export const useTypedSWR = (
key: SWRKey,
fetcher: Fetcher | null,
config?: SWRConfiguration>
-): SWRResponse => useSWR(key, fetcher, config);
+) => useSWR(key, fetcher, config);
+/** Fetcher must not return (awaited) `undefined` value - results in endless fetching. */
export const useRetryableSWR = (
key: SWRKey,
- fetcher: Fetcher | null,
+ fetcher: Data extends undefined ? never : Fetcher | null,
config?: SWRConfiguration>
-): SWRResponse => useSWR(key, fetcher, { errorRetryCount: 2, ...config });
+) => useSWR(key, fetcher, { errorRetryCount: 2, ...config });