mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 08:23:34 +00:00
21 lines
649 B
TypeScript
21 lines
649 B
TypeScript
import { useMemo } from 'react';
|
|
import { ProjectsManager } from '@/lib/ProjectsManager';
|
|
import { useFS } from '@/hooks/useFS';
|
|
import { useFSPaths } from '@/hooks/useFSPaths';
|
|
import { useGit } from './useGit';
|
|
|
|
/**
|
|
* Hook that provides a ProjectsManager instance.
|
|
* The ProjectsManager is memoized based on the fs instance and configured paths.
|
|
*/
|
|
export function useProjectsManager() {
|
|
const { fs } = useFS();
|
|
const { git } = useGit();
|
|
const { projectsPath } = useFSPaths();
|
|
|
|
const projectsManager = useMemo(() => {
|
|
return new ProjectsManager({ fs, git, projectsPath });
|
|
}, [fs, git, projectsPath]);
|
|
|
|
return projectsManager;
|
|
} |