Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

536 B
Raw Blame
import { useMemo } from 'react'

import type { ProjectScope } from '@/api/reports'

import { useAuthStore } from './authStore'

export function useProjectScope(): ProjectScope | null {
    const signedIn = useAuthStore((state) => state.signedIn)
    const host = useAuthStore((state) => state.host)
    const projectId = useAuthStore((state) => state.projectId)
    return useMemo(
        () => (signedIn && host && projectId !== null ? { host: host.replace(/\/$/, ''), projectId } : null),
        [signedIn, host, projectId]
    )
}