Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

1.1 KB
Raw Blame
'use client';

import AsyncError from '@/components/AsyncError';
import { RouteLoading } from '@/components/Skeleton/RouteSegment';
import { AgentTasksPage } from '@/features/AgentTasks';
import { LinearSyncEntry } from '@/features/Projects/LinearSync';
import { useActiveRouteParams } from '@/hooks/useActiveRouteParams';
import { useCurrentProjectDetail, useProjectStore } from '@/store/project';

const ProjectTasks = () => {
  const { projectId } = useActiveRouteParams<{ projectId: string }>();
  // The persisted project paints on the first frame; the hook only syncs it.
  const detail = useCurrentProjectDetail(projectId);
  const { error, isHydrated, isValidating, revalidate } = useProjectStore(
    (s) => s.useFetchProjectDetail,
  )(projectId);

  if (!detail && (!isHydrated || isValidating)) return <RouteLoading />;
  if (error && !detail)
    return <AsyncError error={error} variant={'page'} onRetry={() => void revalidate()} />;
  if (!detail) return null;

  return (
    <AgentTasksPage
      headerActions={<LinearSyncEntry projectId={detail.project.id} />}
      projectId={detail.project.id}
    />
  );
};

export default ProjectTasks;