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.

improve RewardSkeleton

Steven Tey7ad0df971d91
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/rewards/reward-settings.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/rewards/reward-settings.tsx
index 960a915317..bde63d231c 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/rewards/reward-settings.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/rewards/reward-settings.tsx
@@ -282,14 +282,11 @@ const CreateRewardButton = () => {
const RewardSkeleton = () => {
return (
- <div className="flex animate-pulse items-center gap-4 rounded-lg border border-neutral-200 p-4">
- <div className="flex size-10 items-center justify-center rounded-full border border-neutral-200 bg-neutral-50" />
+ <div className="flex items-center gap-4 rounded-lg border border-neutral-200 p-4">
+ <div className="flex size-10 animate-pulse items-center justify-center rounded-full border border-neutral-200 bg-neutral-100" />
<div className="flex flex-1 items-center justify-between">
- <div className="space-y-3">
- <div className="h-4 w-64 rounded bg-neutral-100" />
- <div className="h-4 w-32 rounded bg-neutral-100" />
- </div>
- <div className="h-6 w-24 rounded-full bg-neutral-100" />
+ <div className="h-4 w-64 animate-pulse rounded bg-neutral-100" />
+ <div className="h-6 w-24 animate-pulse rounded-full bg-neutral-100" />
</div>
</div>
);
diff --git a/apps/web/lib/actions/partners/create-reward.ts b/apps/web/lib/actions/partners/create-reward.ts
index 167d96a97a..9fb5efa474 100644
--- a/apps/web/lib/actions/partners/create-reward.ts
+++ b/apps/web/lib/actions/partners/create-reward.ts
@@ -35,7 +35,7 @@ export const createRewardAction = authActionClient
if (programWideRewardCount > 0) {
throw new Error(
- `There is an existing program-wide reward for ${event}.`,
+ `There is an existing program-wide ${event} reward already. Either update the existing reward to be partner-specific or create a partner-specific reward.`,
);
}
}
diff --git a/apps/web/lib/swr/use-rewards.ts b/apps/web/lib/swr/use-rewards.ts
index 360b23cb43..f7322dce00 100644
--- a/apps/web/lib/swr/use-rewards.ts
+++ b/apps/web/lib/swr/use-rewards.ts
@@ -15,6 +15,7 @@ export default function useRewards() {
fetcher,
{
dedupingInterval: 60000,
+ keepPreviousData: true,
},
);