Skip to content

Commit e3dca50

Browse files
chore: Fix workspace state in UI (#1069)
1 parent 451e4f6 commit e3dca50

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

apps/web/app/routes/ws/_components/WorkspaceSelector.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Check, ChevronDown } from "lucide-react";
22
import { NavLink } from "react-router";
33

4+
import { useWorkspace } from "~/components/WorkspaceProvider";
45
import { Button } from "~/components/ui/button";
56
import {
67
DropdownMenu,
@@ -18,12 +19,9 @@ import {
1819

1920
export const WorkspaceSelector: React.FC<{
2021
viewer: { email: string };
21-
activeWorkspaceId?: string | null;
2222
workspaces: Array<{ id: string; slug: string; name: string }>;
23-
}> = ({ viewer, activeWorkspaceId, workspaces }) => {
24-
const workspace =
25-
workspaces.find((w) => w.id === activeWorkspaceId) ?? workspaces.at(0);
26-
if (workspace == null) return;
23+
}> = ({ viewer, workspaces }) => {
24+
const { workspace } = useWorkspace();
2725
return (
2826
<DropdownMenu>
2927
<DropdownMenuTrigger asChild>

apps/web/app/routes/ws/_layout.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,7 @@ export default function WorkspaceLayout() {
196196
<SidebarMenu>
197197
<SidebarMenuItem>
198198
{viewer != null && (
199-
<WorkspaceSelector
200-
viewer={viewer}
201-
activeWorkspaceId={viewer.activeWorkspaceId}
202-
workspaces={workspaces}
203-
/>
199+
<WorkspaceSelector viewer={viewer} workspaces={workspaces} />
204200
)}
205201
</SidebarMenuItem>
206202
</SidebarMenu>

0 commit comments

Comments
 (0)