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.

fix getNextPlan and useFolder

Steven Tey02501564bc31
diff --git a/apps/web/lib/swr/use-folder.ts b/apps/web/lib/swr/use-folder.ts
index b9cd745e06..22eedaeb63 100644
--- a/apps/web/lib/swr/use-folder.ts
+++ b/apps/web/lib/swr/use-folder.ts
@@ -5,7 +5,7 @@ import useWorkspace from "./use-workspace";
export default function useFolder({
folderId,
- enabled,
+ enabled = true,
}: {
folderId?: string | null;
enabled?: boolean;
diff --git a/apps/web/ui/links/links-toolbar.tsx b/apps/web/ui/links/links-toolbar.tsx
index a0291e85bb..050e5e3705 100644
--- a/apps/web/ui/links/links-toolbar.tsx
+++ b/apps/web/ui/links/links-toolbar.tsx
@@ -49,9 +49,10 @@ export const LinksToolbar = memo(
links: ResponseLink[];
linksCount: number;
}) => {
- const { flags, slug, plan } = useWorkspace();
+ const { slug, plan } = useWorkspace();
const { isMegaFolder } = useIsMegaFolder();
+ console.log({ isMegaFolder });
const { canManageFolderPermissions } = getPlanCapabilities(plan);
const { folders } = useFolderPermissions();
diff --git a/packages/utils/src/constants/pricing.tsx b/packages/utils/src/constants/pricing.tsx
index 9ca006ccec..1537d25dc6 100644
--- a/packages/utils/src/constants/pricing.tsx
+++ b/packages/utils/src/constants/pricing.tsx
@@ -353,7 +353,11 @@ export const getNextPlan = (plan?: string | null) => {
if (!plan) return PRO_PLAN;
const currentPlan = plan.toLowerCase().split(" ")[0]; // to account for old Business plans (e.g. "Business Plus")
return PLANS[
- PLANS.findIndex((p) => p.name.toLowerCase() === currentPlan) + 1
+ Math.min(
+ // returns the next plan, or the last plan if the current plan is the last plan
+ PLANS.findIndex((p) => p.name.toLowerCase() === currentPlan) + 1,
+ PLANS.length - 1,
+ )
];
};