Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

revert onTokenExpired

Steven Teye1fd647dd88c
diff --git a/apps/web/app/app.dub.co/(dashboard)/account/settings/referrals/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/account/settings/referrals/page-client.tsx
index 08504e7318..8c5b029e24 100644
--- a/apps/web/app/app.dub.co/(dashboard)/account/settings/referrals/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/account/settings/referrals/page-client.tsx
@@ -12,11 +12,7 @@ export function ReferralsPageClient() {
const { data: session, status } = useSession();
const referralLinkId = session?.user?.["referralLinkId"];
- const {
- data: { publicToken } = {},
- isLoading,
- mutate,
- } = useSWRImmutable<{
+ const { data: { publicToken } = {}, isLoading } = useSWRImmutable<{
publicToken: string;
}>(referralLinkId && "/api/user/embed-tokens", fetcher, {
keepPreviousData: true,
@@ -47,11 +43,5 @@ export function ReferralsPageClient() {
);
}
- return (
- <DubWidget
- token={publicToken}
- variant="inline"
- options={{ onTokenExpired: () => mutate() }}
- />
- );
+ return <DubWidget token={publicToken} variant="inline" />;
}
diff --git a/apps/web/app/app.dub.co/embed/token.tsx b/apps/web/app/app.dub.co/embed/token.tsx
index 31fc5d207b..d94780024c 100644
--- a/apps/web/app/app.dub.co/embed/token.tsx
+++ b/apps/web/app/app.dub.co/embed/token.tsx
@@ -7,7 +7,8 @@ import useSWR from "swr";
export const LinkToken = () => {
const { error } = useSWR<{ token: number }>("/api/embed/token", fetcher, {
revalidateOnFocus: true,
- refreshInterval: 50000,
+ dedupingInterval: 30000,
+ keepPreviousData: true,
});
// Inform the parent if there's an error (Eg: token is expired)