Files
DeepTutor/web/hooks/useActiveWorkspaceId.ts
2026-10-18 23:09:10 +08:00

10 lines
341 B
TypeScript

'use client'
import { useSearchParams } from 'next/navigation'
import { activeWorkspaceId, workspaceIdOf } from '@/lib/workspace-scope'
/** The workspace this tab is in, for render: the URL's, else the one it stayed in. */
export function useActiveWorkspaceId(): string {
return workspaceIdOf(useSearchParams()) ?? activeWorkspaceId()
}