The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
hide staging workspaces in workspace selector / workspaces page
Steven Tey8cca9168221d
diff --git a/apps/web/app/app.dub.co/(onboarding)/workspaces/page.tsx b/apps/web/app/app.dub.co/(onboarding)/workspaces/page.tsxindex fa6aa1da15..bb55f05a9e 100644--- a/apps/web/app/app.dub.co/(onboarding)/workspaces/page.tsx+++ b/apps/web/app/app.dub.co/(onboarding)/workspaces/page.tsx@@ -1,5 +1,6 @@"use client";+import { isStagingEnvironment } from "@/lib/sandbox/environment";import useWorkspaces from "@/lib/swr/use-workspaces";import { WorkspaceProps } from "@/lib/types";import { useAddWorkspaceModal } from "@/ui/modals/add-workspace-modal";@@ -16,6 +17,9 @@ import { ComponentType, SVGProps, useState } from "react";export default function WorkspacesPage() {const { workspaces, error } = useWorkspaces();+ const visibleWorkspaces = workspaces?.filter(+ (workspace) => !isStagingEnvironment(workspace.environment),+ );return (<div className="flex min-h-[100dvh] w-full flex-col">@@ -26,10 +30,10 @@ export default function WorkspacesPage() {title="Unable to load workspaces"description="Something went wrong while fetching your workspaces. Please refresh the page to try again."/>- ) : !workspaces ? (+ ) : !visibleWorkspaces ? (<WorkspaceListSkeleton />- ) : workspaces.length > 0 ? (- <WorkspaceList workspaces={workspaces} />+ ) : visibleWorkspaces.length > 0 ? (+ <WorkspaceList workspaces={visibleWorkspaces} />) : (<NoWorkspaces />)}diff --git a/apps/web/ui/workspaces/workspace-selector.tsx b/apps/web/ui/workspaces/workspace-selector.tsxindex 6898915772..0c8e2ee6d0 100644--- a/apps/web/ui/workspaces/workspace-selector.tsx+++ b/apps/web/ui/workspaces/workspace-selector.tsx@@ -1,3 +1,4 @@+import { isStagingEnvironment } from "@/lib/sandbox/environment";import useWorkspaces from "@/lib/swr/use-workspaces";import { BlurImage, Button, Combobox } from "@dub/ui";import { cn } from "@dub/utils";@@ -29,9 +30,10 @@ export function WorkspaceSelector({return [];}- return workspaces.filter(- (workspace) =>- !environments || environments.includes(workspace.environment),+ return workspaces.filter((workspace) =>+ environments+ ? environments.includes(workspace.environment)+ : !isStagingEnvironment(workspace.environment),);}, [workspaces, environments]);